-
Notifications
You must be signed in to change notification settings - Fork 463
Re-introduce content language for YouTube #257
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d70b127
reintroduce content language for youtube
B0pol 0d17625
refix subscriber count
B0pol a9c6bee
Merge branch 'dev' into localisation
B0pol 2eb9f5c
HashMap for abbreviations
B0pol f5d1952
added comment for explaination
B0pol 0fd7484
Refactor AbbreviationHashMap, add javadoc for it
B0pol e51cd2a
address suggestino on AbbreviationHelper and related
B0pol b4ddb08
Merge branch 'dev' into localisation
B0pol 62effa0
resolve merge conflicts
B0pol 9b61203
3 more abbreviations found, improve ut method
B0pol 88f9ab9
Refactored YouTubeSubscriberTest
B0pol ff6c6a8
small reformatting
B0pol e52a86d
improve createFile func
B0pol 8e0c725
refactor mixedWordtolong&improve YTBSubscriberTest
B0pol 4e91921
debug branch
B0pol ea68770
fix travis CI + some typos
B0pol a60aa10
actually fix testGetFullLinksInDescription
B0pol 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
136 changes: 136 additions & 0 deletions
136
.../schabi/newpipe/extractor/services/youtube/extractors/YoutubeAbbreviationSubCountMap.java
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,136 @@ | ||
package org.schabi.newpipe.extractor.services.youtube.extractors; | ||
|
||
import java.util.HashMap; | ||
|
||
public class YoutubeAbbreviationSubCountMap { | ||
|
||
//should be safe until someone has 1 billion subscribers on YouTube | ||
public static final HashMap<String, String> abbreviationSubscribersCount = new HashMap<>(); | ||
public static String englishMillionAbbreviation = "M"; | ||
B0pol marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public static String englishThousandAbbreviation = "K"; | ||
public static String tenThousandAbbreviation = "万"; | ||
public static String hundredThousandAbbreviation = "ল"; | ||
public static String tenMillionAbbreviation = "ক"; | ||
public static String hundredMillionAbbreviation = "億"; | ||
|
||
static { | ||
abbreviationSubscribersCount.put(englishThousandAbbreviation, englishThousandAbbreviation); //az, iw, en | ||
abbreviationSubscribersCount.put(englishMillionAbbreviation, englishMillionAbbreviation); //iw, en | ||
abbreviationSubscribersCount.put(tenThousandAbbreviation, tenThousandAbbreviation); | ||
abbreviationSubscribersCount.put(hundredMillionAbbreviation, hundredMillionAbbreviation); | ||
abbreviationSubscribersCount.put(tenMillionAbbreviation, tenMillionAbbreviation); | ||
abbreviationSubscribersCount.put(hundredMillionAbbreviation, hundredMillionAbbreviation); | ||
|
||
abbreviationSubscribersCount.put(" k", englishThousandAbbreviation); //af | ||
abbreviationSubscribersCount.put(" m", englishMillionAbbreviation); //af, is | ||
abbreviationSubscribersCount.put(" ሺ", englishThousandAbbreviation); //am | ||
abbreviationSubscribersCount.put(" ሜትር", englishMillionAbbreviation); //am | ||
abbreviationSubscribersCount.put(" ألف", englishThousandAbbreviation); //ar | ||
abbreviationSubscribersCount.put(" مليون", englishMillionAbbreviation); //ar | ||
abbreviationSubscribersCount.put(" mln", englishMillionAbbreviation); //az, et, lt, nl, pl, sq, uz | ||
abbreviationSubscribersCount.put(" тыс", englishThousandAbbreviation); //be, ru | ||
abbreviationSubscribersCount.put(" млн", englishMillionAbbreviation); //be, bg, kk, ky, ru, uk | ||
abbreviationSubscribersCount.put(" хил", englishThousandAbbreviation); //bg | ||
abbreviationSubscribersCount.put(" হা", englishThousandAbbreviation); //bn | ||
abbreviationSubscribersCount.put(" hilj", englishThousandAbbreviation); //bs, sr | ||
abbreviationSubscribersCount.put(" mil", englishMillionAbbreviation); //bs, cs, hr, ro, sk, sr-Latn | ||
abbreviationSubscribersCount.put("m", englishThousandAbbreviation); //ca | ||
abbreviationSubscribersCount.put(" M", englishMillionAbbreviation); //ca, es, eu, and many more | ||
B0pol marked this conversation as resolved.
Show resolved
Hide resolved
|
||
abbreviationSubscribersCount.put(" tis", englishThousandAbbreviation); //cs, hr, sk, sl | ||
abbreviationSubscribersCount.put(" mio", englishMillionAbbreviation); //da, sl | ||
abbreviationSubscribersCount.put(" Mio", englishMillionAbbreviation); //de | ||
abbreviationSubscribersCount.put(" χιλ", englishThousandAbbreviation); //el | ||
abbreviationSubscribersCount.put(" εκ", englishMillionAbbreviation); //el | ||
abbreviationSubscribersCount.put(" tuh", englishThousandAbbreviation); //et | ||
abbreviationSubscribersCount.put(" هزار", englishThousandAbbreviation); //fa | ||
abbreviationSubscribersCount.put(" میلیون", englishMillionAbbreviation); //fa | ||
abbreviationSubscribersCount.put(" t", englishThousandAbbreviation); //fi | ||
abbreviationSubscribersCount.put(" milj", englishMillionAbbreviation); //fi, lv | ||
abbreviationSubscribersCount.put(" હજાર", englishThousandAbbreviation); //gu | ||
abbreviationSubscribersCount.put(" हज़ार", englishThousandAbbreviation); //hi | ||
abbreviationSubscribersCount.put(" E", englishThousandAbbreviation); //hu | ||
abbreviationSubscribersCount.put(" հզր", englishThousandAbbreviation); //hy | ||
abbreviationSubscribersCount.put(" մլն", englishMillionAbbreviation); //hy | ||
abbreviationSubscribersCount.put(" rb", englishThousandAbbreviation); //id | ||
abbreviationSubscribersCount.put(" jt", englishMillionAbbreviation); //id | ||
abbreviationSubscribersCount.put(" þ", englishThousandAbbreviation); //is | ||
abbreviationSubscribersCount.put(" Mln", englishMillionAbbreviation); //it | ||
abbreviationSubscribersCount.put(" ათ", englishThousandAbbreviation); //ka | ||
abbreviationSubscribersCount.put(" მლნ", englishMillionAbbreviation); //ka | ||
abbreviationSubscribersCount.put(" мың", englishThousandAbbreviation); //kk | ||
abbreviationSubscribersCount.put("ពាន់", englishThousandAbbreviation); //km | ||
abbreviationSubscribersCount.put(" ពាន់", englishThousandAbbreviation); //km | ||
abbreviationSubscribersCount.put(" លាន", englishMillionAbbreviation); //km | ||
abbreviationSubscribersCount.put("ಸಾ", englishThousandAbbreviation); //kn | ||
abbreviationSubscribersCount.put("ಮಿ", englishMillionAbbreviation); //kn | ||
abbreviationSubscribersCount.put("천", englishThousandAbbreviation); //ko | ||
abbreviationSubscribersCount.put(" миң", englishThousandAbbreviation); //ky | ||
abbreviationSubscribersCount.put(" ກີບ", englishThousandAbbreviation); //lo | ||
abbreviationSubscribersCount.put(" ພັນ", englishThousandAbbreviation); //lo | ||
abbreviationSubscribersCount.put(" ລ້ານ", englishMillionAbbreviation); //lo | ||
abbreviationSubscribersCount.put(" tūkst", englishThousandAbbreviation); //lt, lv | ||
abbreviationSubscribersCount.put(" илј", englishThousandAbbreviation); //mk | ||
abbreviationSubscribersCount.put(" мил", englishMillionAbbreviation); //mk, sr | ||
abbreviationSubscribersCount.put(" мянга", englishThousandAbbreviation); //mn | ||
abbreviationSubscribersCount.put(" сая", englishMillionAbbreviation); //mn | ||
abbreviationSubscribersCount.put(" ह", englishThousandAbbreviation); //mr | ||
abbreviationSubscribersCount.put("ထောင်", englishThousandAbbreviation); //my | ||
abbreviationSubscribersCount.put("သန်း", englishMillionAbbreviation); //my | ||
abbreviationSubscribersCount.put(" हजार", englishThousandAbbreviation); //ne | ||
abbreviationSubscribersCount.put("k", englishThousandAbbreviation); //no | ||
abbreviationSubscribersCount.put(" mill", englishMillionAbbreviation); //no | ||
abbreviationSubscribersCount.put(" ਹਜ਼ਾਰ", englishThousandAbbreviation); //pa | ||
abbreviationSubscribersCount.put(" tys", englishThousandAbbreviation); //pl | ||
abbreviationSubscribersCount.put(" mi", englishMillionAbbreviation); //pt | ||
abbreviationSubscribersCount.put(" K", englishThousandAbbreviation); //ro | ||
abbreviationSubscribersCount.put("ද", englishThousandAbbreviation); //si | ||
abbreviationSubscribersCount.put("මි", englishMillionAbbreviation); //si | ||
abbreviationSubscribersCount.put(" mijë", englishThousandAbbreviation); //sq | ||
abbreviationSubscribersCount.put(" хиљ", englishThousandAbbreviation); //sr-Latn | ||
abbreviationSubscribersCount.put(" mn", englishMillionAbbreviation); //sv | ||
abbreviationSubscribersCount.put("elfu ", englishThousandAbbreviation); //sw | ||
abbreviationSubscribersCount.put("ஆ", englishThousandAbbreviation); //ta | ||
abbreviationSubscribersCount.put("மி", englishMillionAbbreviation); //ta | ||
abbreviationSubscribersCount.put("వే", englishThousandAbbreviation); //te | ||
abbreviationSubscribersCount.put("మి", englishMillionAbbreviation); //te | ||
abbreviationSubscribersCount.put(" พัน", englishThousandAbbreviation); //th | ||
abbreviationSubscribersCount.put(" ล้าน", englishMillionAbbreviation); //th | ||
abbreviationSubscribersCount.put(" B", englishThousandAbbreviation); //tr | ||
abbreviationSubscribersCount.put(" Mn", englishMillionAbbreviation); //tr | ||
abbreviationSubscribersCount.put(" тис", englishThousandAbbreviation); //uk | ||
abbreviationSubscribersCount.put(" ہزار", englishThousandAbbreviation); //ur | ||
abbreviationSubscribersCount.put(" ming", englishThousandAbbreviation); //uz | ||
abbreviationSubscribersCount.put(" N", englishThousandAbbreviation); //vi | ||
abbreviationSubscribersCount.put(" Tr", englishMillionAbbreviation); //vi | ||
|
||
abbreviationSubscribersCount.put("만", tenThousandAbbreviation); //ko | ||
abbreviationSubscribersCount.put("万", tenThousandAbbreviation); //ja, zh-CN | ||
abbreviationSubscribersCount.put("萬", tenThousandAbbreviation); //zh-TW | ||
|
||
abbreviationSubscribersCount.put(" লা", hundredThousandAbbreviation); //bn | ||
abbreviationSubscribersCount.put(" લાખ", hundredThousandAbbreviation); //gu | ||
abbreviationSubscribersCount.put(" लाख", hundredThousandAbbreviation); //hi, mr, ne | ||
abbreviationSubscribersCount.put(" ਲੱਖ", hundredThousandAbbreviation); //pa | ||
abbreviationSubscribersCount.put(" لاکھ", hundredThousandAbbreviation); //ur | ||
abbreviationSubscribersCount.put("သိန်း", hundredThousandAbbreviation); //my | ||
abbreviationSubscribersCount.put(" แสน", hundredThousandAbbreviation); //th | ||
|
||
abbreviationSubscribersCount.put(" কো", tenMillionAbbreviation); //bn | ||
abbreviationSubscribersCount.put(" કરોડ", tenMillionAbbreviation); //gu | ||
abbreviationSubscribersCount.put(" क॰", tenMillionAbbreviation); //hi | ||
abbreviationSubscribersCount.put(" कोटी", tenMillionAbbreviation); //mr | ||
abbreviationSubscribersCount.put("ကုဋေ", tenMillionAbbreviation); //my | ||
abbreviationSubscribersCount.put(" करोड", tenMillionAbbreviation); //ne | ||
abbreviationSubscribersCount.put(" ਕਰੋੜ", tenMillionAbbreviation); //pa | ||
abbreviationSubscribersCount.put(" کروڑ", tenMillionAbbreviation); //ur | ||
|
||
abbreviationSubscribersCount.put("億", hundredMillionAbbreviation); //ja, zh-TW | ||
abbreviationSubscribersCount.put("억", hundredMillionAbbreviation); //ko | ||
abbreviationSubscribersCount.put("亿", hundredMillionAbbreviation); //zh-CN | ||
|
||
abbreviationSubscribersCount.put(" م", englishMillionAbbreviation); //an | ||
abbreviationSubscribersCount.put("ሜ", englishMillionAbbreviation); //am | ||
abbreviationSubscribersCount.put(" М", englishMillionAbbreviation); //mk, narrow non-breaking space, ie U+202F | ||
|
||
} | ||
} |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a JavaDoc for this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about the class name, too. I assume that these abbreviations can be used by other services, too. Is this correct? If yes, please move this file to the extractor utils.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it can be used if one wants to parse abbreviations from languages (and if some are missing for a service, it can easily be added).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the JavaDoc good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, looks good. however, the class is not a map. we should rename it and change that part in the doc, too.