File tree Expand file tree Collapse file tree
main/java/org/schabi/newpipe/extractor/services/youtube Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,11 +107,28 @@ public String getName() throws ParsingException {
107107 }
108108 }
109109
110+ @ Override
111+ public String getUploaderUrl () throws ParsingException {
112+ try {
113+ String link = getUploaderLink ().attr ("href" );
114+ if (link .isEmpty ()) {
115+ throw new IllegalArgumentException ("is empty" );
116+ }
117+ return link ;
118+ } catch (Exception e ) {
119+ throw new ParsingException ("Could not get Uploader name" );
120+ }
121+ }
122+
123+ private Element getUploaderLink () {
124+ Element uploaderEl = el .select ("div[class*=\" yt-lockup-byline \" ]" ).first ();
125+ return uploaderEl .select ("a" ).first ();
126+ }
127+
110128 @ Override
111129 public String getUploaderName () throws ParsingException {
112130 try {
113- Element uploaderEl = el .select ("div[class*=\" yt-lockup-byline \" ]" ).first ();
114- return uploaderEl .select ("a" ).text ();
131+ return getUploaderLink ().text ();
115132 } catch (Exception e ) {
116133 throw new ParsingException ("Could not get Uploader name" );
117134 }
Original file line number Diff line number Diff line change 2424import org .junit .Test ;
2525import org .schabi .newpipe .Downloader ;
2626import org .schabi .newpipe .extractor .NewPipe ;
27- import org .schabi .newpipe .extractor .kiosk .KioskExtractor ;
2827import org .schabi .newpipe .extractor .stream .StreamInfoItemCollector ;
2928
3029import static junit .framework .TestCase .assertFalse ;
4039 */
4140public class YoutubeTrendingExtractorTest {
4241
43- KioskExtractor extractor ;
42+ YoutubeTrendingExtractor extractor ;
4443
4544 @ Before
4645 public void setUp () throws Exception {
4746 NewPipe .init (Downloader .getInstance ());
48- extractor = YouTube .getService ()
47+ extractor = ( YoutubeTrendingExtractor ) YouTube .getService ()
4948 .getKioskList ()
5049 .getExtractorById ("Trending" , null );
5150 }
You can’t perform that action at this time.
0 commit comments