0

I'm trying to get a specific element off YouTube (the title of the video).

HTML: http://pastebin.com/cjr2SgNd

Important HTML part:

<span id="eow-title" class="watch-title " dir="ltr" title="Latest Agar.io PvP - Create Your Own Server!"></span>

I would like to find this: title="Latest Agar.io PvP - Create Your Own Server!"

However, I get this error: http://pastebin.com/G7x9FZaa

I'm using Jaunt to get the title. Code:

UserAgent userAgent = new UserAgent();
//troubleshooting
System.out.println("working");

List<String> vid = userAgent.doc.findAttributeValues("<span title>");
System.out.println(vid);
//troubleshooting
System.out.println("working1");
ruyili
  • 694
  • 10
  • 25
  • Your stack trace says the exception happened on line 39 of YouConverter.java. Which line of your snippet is that? – Justin Anderson Jan 25 '16 at 01:00
  • List vid = userAgent.doc.findAttributeValues(""); – ruyili Jan 25 '16 at 01:01
  • So if userAgent is a new UserAgent object with nothing else done to it, userAgent.doc will be null. Look for some Jaunt tutorials for how to use the UserAgent class. – Justin Anderson Jan 25 '16 at 02:16
  • OMG LOL, I think I accidently removed that line of code (userAgent.visit)since I had to copy the code and switch it to another class because of workspace issues. Thank you lol – ruyili Jan 25 '16 at 21:26

0 Answers0