<div class="tweet-text"> <a class="name" href="http://funtweets.com/u/MikeJeffJordan"><span>@</span>MikeJeffJordan</a><br> My local grocery store has a special deal going on at the self scan aisle, buy one get like 30 free. </div>

I am not sure how to aquire the text that the user says? Also how would you acuire not just the first initial post, but the first few posts (without re-parsing the website 3 times for the first posts)

>>> import requests>>> import lxml.html>>> r = requests.get('http://funtweets.com/random', headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; rv:28.0) Gecko/20100101 Firefox/28.0'})>>> doc = lxml.html.fromstring(r.content)>>> for tweet in doc.xpath('//div[@class="tweet-text"]'):... ''.join(tweet.xpath('./text()')).strip()..."Hey Bradley Cooper's eyes: the most beautiful sky imaginable called - it wants it's color back"'My clients have a 86% survival rate, which makes me an above-average babysitter.''I bought my kids electric toothbrushes because it was taking too long to splatter toothpaste all over the bathroom w/the regular toothbrush.'"let's head over to the barber shop and make hair angels on the floor"'Whenever someone holds my baby & he makes even a tiny peep, I yell "WHAT DID YOU DO TO MY BABY WHY ARE YOU BURNING MY BABY!?"'"Based on the novel 'Push Notifications' by iSapphire"

That looks like it would work.....except i dont have the "requests" module. I do have a version of lxml that might work but i cant import requests obviously.......... and this is why ive been working on this script for over a week....

Tried it and it said "xml is not defined". So frustrating. Note: I used import xml.etree.cElementTree as etree to use lxml because lxml documentation said to do that to uselxml. Annoying......

Not checked,but as said in other post i doubt that lxml work for android(sl4a).There are of course more way to solve this,here a more mad and not advisable way with regex(because html and regex are not best friends)

Wow. How about saving the soup to a string and then slicing it? I will post that as a seperate Forum topic later unless that's a bad idea. Note: when I try to save the soup as aString and then slice the string I get told its an "unhashable type. Lol. I suck at this.

Rule 1: All text in an html document(including whitespace, e.g. a newline after the end of a tag) is contained in a "Text Node", which means it's as if the text is inside an invisible <text> tag.

The text you are after is contained inside the 'tweet' <div>. The <a> tag is the first child of the 'tweet' <div>... Wrong! There is whitespace after the end of the 'tweet' <div>, which is contained inside an invisible <text> tag, and that <text> tag is the first child of the 'tweet' <div>. The second child is the <a> tag, and the third child is the invisible <text> tag that contains the text that the user said. So, you are after the third child of the 'tweet' <div>:

for div in tweet_divs: print(div[0].tail) #lxml's default setup ignores whitespace between tags, so no Text Nodes are created for the whitespace. #A tag can be treated as a list of its children. #The first child of the div tag, div[0], is the <a> tag. #tail gives the text after the end of a tag--up to the start of the next tag.

--output:-- 90% of the economy is just women giving each other useless gifts.

Caterpillars: Neither cats NOR pillars.

I think the world of you! (Polluted, poor, generally prone to disaster.)

If you're in Los Angeles and lost your wallet near the Starbucks on Melrose I found your wallet but not the $58 inside it.

...

Or, you could go straight to the <a> tag and get its tail.Or, you could use a combination of both(which makes it more likely you'll get the correct <a> tags):