File tree Expand file tree Collapse file tree
extractor/src/main/java/org/schabi/newpipe/extractor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public abstract class Info implements Serializable {
2727 *
2828 * @see Extractor#getOriginalUrl()
2929 */
30- private final String originalUrl ;
30+ private String originalUrl ;
3131 private final String name ;
3232
3333 private final List <Throwable > errors = new ArrayList <>();
@@ -62,6 +62,12 @@ public String toString() {
6262 return getClass ().getSimpleName () + "[url=\" " + url + "\" " + ifDifferentString + ", name=\" " + name + "\" ]" ;
6363 }
6464
65+ // if you use an api and want to handle the website url
66+ // overriding original url is essential
67+ public void setOriginalUrl (String url ) {
68+ originalUrl = url ;
69+ }
70+
6571 public int getServiceId () {
6672 return serviceId ;
6773 }
Original file line number Diff line number Diff line change @@ -61,7 +61,11 @@ public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException
6161 extractor .getLinkHandler (),
6262 extractor .getName ());
6363
64-
64+ try {
65+ info .setOriginalUrl (extractor .getOriginalUrl ());
66+ } catch (Exception e ) {
67+ info .addError (e );
68+ }
6569 try {
6670 info .setAvatarUrl (extractor .getAvatarUrl ());
6771 } catch (Exception e ) {
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ public static PlaylistInfo getInfo(PlaylistExtractor extractor) throws Extractio
4747 extractor .getLinkHandler (),
4848 extractor .getName ());
4949
50+ try {
51+ info .setOriginalUrl (extractor .getOriginalUrl ());
52+ } catch (Exception e ) {
53+ info .addError (e );
54+ }
5055 try {
5156 info .setStreamCount (extractor .getStreamCount ());
5257 } catch (Exception e ) {
Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ public static SearchInfo getInfo(SearchExtractor extractor) throws ExtractionExc
3737 extractor .getLinkHandler (),
3838 extractor .getSearchString ());
3939
40+ try {
41+ info .setOriginalUrl (extractor .getOriginalUrl ());
42+ } catch (Exception e ) {
43+ info .addError (e );
44+ }
4045 try {
4146 info .searchSuggestion = extractor .getSearchSuggestion ();
4247 } catch (Exception e ) {
You can’t perform that action at this time.
0 commit comments