简体   繁体   中英

jsoup: selecting table without specific ID that contains certain text string (select two conditions)

I'm trying to extract the quotes from the following forum: http://forum.xda-developers.com/showthread.php?t=1772338

All worked with:

Elements postquote = doc.select("table[cellpadding=6][cellspacing=0]");

BUT: The problem in this particular thread is, that the editor used the quoting-format to format his text and not to quote another user.

My approach was to search aditionally for "Originally Posted by"

Elements postquote = doc.select("table[cellpadding=6][cellspacing=0], table:contains(Originally Posted by)");
  • How can I combine two ore more select conditions? (Jsoup syntax states "," but that does not work)
  • What's wrong? How could I extract the REAL Posts more easy?

If you want to find table[cellpadding=6][cellspacing=0] that also contains Originally Posted by then just use

doc.select("table[cellpadding=6][cellspacing=0]:contains(Originally Posted by)"). 

Also , represents OR so it will try to find somethingLikeThis OR somethingLikeThat so it will generate additional results rather than narrowing them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM