First time access the Javascript, it looks like:
please find https://xueqiu.com/v4/statuses/user_timeline.json?page=1&user_id=4357540281
{ count: 20
, statuses:
[ { id : 180
, user_id : 435
, source : '111'
, title : 'aa'
, created_at : 1621
, retweet_count : 0
, reply_count : 1
, Timebefore : '05-20 5-15 8:00'
...
id : 181
, user_id : 436
, source : '111'
, title : 'bb'
, created_at : 1621
, retweet_count : 0
, reply_count : 1
, Timebefore : '05-19 5-15 8:00'
I only want to choose value under the condition: Timebefore contains value:'5 -20'.And no idea why could I achieve attribute selection. In selenium, I can try like text contains sth, here I wanna it retuns timebefore contains s specific date. I tried:
with requests.Session() as connection:
connection.headers["User-Agent"] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.86 YaBrowser/21.3.0.740 Yowser/2.5 Safari/537.36"
_ = connection.get("https://xueqiu.com")
user_timeline = connection.get("https://xueqiu.com/v4/statuses/user_timeline.json?page=1&user_id=4357540281").json()
for status in user_timeline["statuses"]:
status["TimeBefore": '05-20']
but it retuns: TypeError: unhashable type: 'slice'
.
Thanks in advance!