-
Notifications
You must be signed in to change notification settings - Fork 8.9k
feat(scroll.in): add new routes #19564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Rjnishant530
wants to merge
8
commits into
DIYgod:master
Choose a base branch
from
Rjnishant530:scroll
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dfe7ff4
add routes
Rjnishant530 057b5ff
addd categoy paths
Rjnishant530 75ca548
use Feed url and cache
Rjnishant530 dbbf4bf
use common code
Rjnishant530 0dab2e8
fix header
Rjnishant530 d7c4f9c
remove cateogries and comments
Rjnishant530 9fec273
trigger rescan
Rjnishant530 a622d1d
add anti Crawler
Rjnishant530 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import { Data, Route, ViewType } from '@/types'; | ||
| import { rootUrl, extractFeedArticleLinks, fetchArticleContent } from './utils'; | ||
|
|
||
| const categoryMap = { | ||
| politics: '76', | ||
| culture: '107', | ||
| india: '105', | ||
| world: '3554', | ||
| }; | ||
|
|
||
| export const route: Route = { | ||
| path: '/category/:category', | ||
| view: ViewType.Articles, | ||
| categories: ['new-media'], | ||
| example: '/scroll/category/india', | ||
| parameters: { | ||
| category: { | ||
| description: 'Category name', | ||
| options: [ | ||
| { value: 'politics', label: 'Politics' }, | ||
| { value: 'culture', label: 'Culture' }, | ||
| { value: 'india', label: 'India' }, | ||
| { value: 'world', label: 'World' }, | ||
| ], | ||
| }, | ||
| }, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: false, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['scroll.in/category/:id/:category'], | ||
| target: '/category/:category', | ||
| }, | ||
| ], | ||
| name: 'Category', | ||
| maintainers: ['Rjnishant530'], | ||
| handler, | ||
| }; | ||
|
|
||
| async function handler(ctx: any) { | ||
| const { category } = ctx.req.param(); | ||
| const categoryId = categoryMap[category.toLowerCase()]; | ||
|
|
||
| if (!categoryId) { | ||
| throw new Error(`Invalid category: ${category}. Valid categories are: ${Object.keys(categoryMap).join(', ')}`); | ||
| } | ||
|
|
||
| const currentUrl = `${rootUrl}/category/${categoryId}/${category}`; | ||
| const articleLinks = await extractFeedArticleLinks(`category/${categoryId}`); | ||
| const items = await Promise.all(articleLinks.map((item) => fetchArticleContent(item))); | ||
|
|
||
| return { | ||
| title: `Scroll.in - ${category.charAt(0).toUpperCase() + category.slice(1)}`, | ||
| description: `Stories published under ${category.charAt(0).toUpperCase() + category.slice(1)}`, | ||
| link: currentUrl, | ||
| item: items, | ||
| language: 'en', | ||
| logo: `${rootUrl}/favicon.ico`, | ||
| icon: `${rootUrl}/favicon.ico`, | ||
| } as Data; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { Data, Route, ViewType } from '@/types'; | ||
| import { rootUrl, extractFeedArticleLinks, fetchArticleContent } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/commonGround', | ||
| view: ViewType.Articles, | ||
| categories: ['new-media'], | ||
| example: '/scroll/commonGround', | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: false, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['scroll.in/topic/56439/common-ground'], | ||
| target: '/commonGround', | ||
| }, | ||
| ], | ||
| name: 'Common Ground', | ||
| maintainers: ['Rjnishant530'], | ||
| handler, | ||
| }; | ||
|
|
||
| async function handler() { | ||
| const currentUrl = `${rootUrl}/topic/56439/common-ground`; | ||
| const articleLinks = await extractFeedArticleLinks('topic/56439'); | ||
|
|
||
| const items = await Promise.all(articleLinks.map((item) => fetchArticleContent(item))); | ||
Rjnishant530 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return { | ||
| title: 'Scroll.in - Common Ground', | ||
| description: 'Common Ground articles from Scroll.in', | ||
| link: currentUrl, | ||
| item: items, | ||
| language: 'en', | ||
| logo: `${rootUrl}/favicon.ico`, | ||
| icon: `${rootUrl}/favicon.ico`, | ||
| } as Data; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { Data, Route, ViewType } from '@/types'; | ||
| import { rootUrl, extractFeedArticleLinks, fetchArticleContent } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/ecoIndia', | ||
| view: ViewType.Articles, | ||
| categories: ['new-media'], | ||
| example: '/scroll/ecoIndia', | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: false, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['scroll.in/topic/56120/eco-india'], | ||
| target: '/ecoIndia', | ||
| }, | ||
| ], | ||
| name: 'Eco India', | ||
| maintainers: ['Rjnishant530'], | ||
| handler, | ||
| }; | ||
|
|
||
| async function handler() { | ||
| const currentUrl = `${rootUrl}/topic/56120/eco-india`; | ||
| const articleLinks = await extractFeedArticleLinks('topic/56120'); | ||
| const items = await Promise.all(articleLinks.map((item) => fetchArticleContent(item))); | ||
Rjnishant530 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return { | ||
| title: 'Scroll.in - Eco India', | ||
| description: 'Eco India articles and videos from Scroll.in', | ||
| link: currentUrl, | ||
| item: items, | ||
| language: 'en', | ||
| logo: `${rootUrl}/favicon.ico`, | ||
| icon: `${rootUrl}/favicon.ico`, | ||
| } as Data; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { Data, Route, ViewType } from '@/types'; | ||
| import { rootUrl, extractFeedArticleLinks, fetchArticleContent } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/latest', | ||
| view: ViewType.Articles, | ||
| categories: ['new-media'], | ||
| example: '/scroll/latest', | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: false, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['scroll.in/latest/'], | ||
| target: '/latest', | ||
| }, | ||
| ], | ||
| name: 'Latest News', | ||
| maintainers: ['Rjnishant530'], | ||
| handler, | ||
| }; | ||
|
|
||
| async function handler() { | ||
| const currentUrl = `${rootUrl}/latest/`; | ||
| const articleLinks = await extractFeedArticleLinks('series/2'); | ||
| const items = await Promise.all(articleLinks.map((item) => fetchArticleContent(item))); | ||
Rjnishant530 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return { | ||
| title: 'Scroll.in - Latest News', | ||
| description: 'Latest news from Scroll.in', | ||
| link: currentUrl, | ||
| item: items, | ||
| language: 'en', | ||
| logo: `${rootUrl}/favicon.ico`, | ||
| icon: `${rootUrl}/favicon.ico`, | ||
| } as Data; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import type { Namespace } from '@/types'; | ||
|
|
||
| export const namespace: Namespace = { | ||
| name: 'Scroll', | ||
| url: 'scroll.in', | ||
| categories: ['new-media'], | ||
| lang: 'en', | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { Data, Route, ViewType } from '@/types'; | ||
| import { rootUrl, extractFeedArticleLinks, fetchArticleContent } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/theIndiaFix', | ||
| view: ViewType.Articles, | ||
| categories: ['new-media'], | ||
| example: '/scroll/theIndiaFix', | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: false, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['scroll.in/topic/56455/the-india-fix'], | ||
| target: '/theIndiaFix', | ||
| }, | ||
| ], | ||
| name: 'The India Fix', | ||
| maintainers: ['Rjnishant530'], | ||
| handler, | ||
| }; | ||
|
|
||
| async function handler() { | ||
| const currentUrl = `${rootUrl}/topic/56455/the-india-fix`; | ||
| const articleLinks = await extractFeedArticleLinks('topic/56455'); | ||
| const items = await Promise.all(articleLinks.map((item) => fetchArticleContent(item))); | ||
Rjnishant530 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return { | ||
| title: 'Scroll.in - The India Fix', | ||
| description: 'The India Fix articles from Scroll.in', | ||
| link: currentUrl, | ||
| item: items, | ||
| language: 'en', | ||
| logo: `${rootUrl}/favicon.ico`, | ||
| icon: `${rootUrl}/favicon.ico`, | ||
| } as Data; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { Data, Route, ViewType } from '@/types'; | ||
| import { rootUrl, extractTrendingArticles, fetchArticleContent } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/trending', | ||
| view: ViewType.Articles, | ||
| categories: ['new-media'], | ||
| example: '/scroll/trending', | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: false, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['scroll.in/trending'], | ||
| target: '/trending', | ||
| }, | ||
| ], | ||
| name: 'Trending', | ||
| maintainers: ['Rjnishant530'], | ||
| handler, | ||
| }; | ||
|
|
||
| async function handler() { | ||
| const currentUrl = `${rootUrl}/trending`; | ||
| const articleLinks = await extractTrendingArticles(); | ||
| const items = await Promise.all(articleLinks.map((item) => fetchArticleContent(item))); | ||
Rjnishant530 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return { | ||
| title: 'Scroll.in - Trending', | ||
| description: 'Trending articles from Scroll.in', | ||
| link: currentUrl, | ||
| item: items, | ||
| language: 'en', | ||
| logo: `${rootUrl}/favicon.ico`, | ||
| icon: `${rootUrl}/favicon.ico`, | ||
| } as Data; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.