Commit 086a6bb1 authored by Cody Zacharias's avatar Cody Zacharias Committed by GitHub

Update feed.py

parent 6aa4d5e9
...@@ -10,6 +10,7 @@ def Follow(response): ...@@ -10,6 +10,7 @@ def Follow(response):
cursor = re.findall(r'cursor=(.*?)">', str(cursor))[0] cursor = re.findall(r'cursor=(.*?)">', str(cursor))[0]
except: except:
pass pass
return follow, cursor return follow, cursor
def Favorite(response): def Favorite(response):
...@@ -20,19 +21,23 @@ def Favorite(response): ...@@ -20,19 +21,23 @@ def Favorite(response):
max_id = re.findall(r'max_id=(.*?)">', str(max_id))[0] max_id = re.findall(r'max_id=(.*?)">', str(max_id))[0]
except: except:
pass pass
return tweets, max_id return tweets, max_id
def Initial(response): def profile(response):
soup = BeautifulSoup(response, "html.parser") json_response = json.loads(response)
html = json_response["items_html"]
soup = BeautifulSoup(html, "html.parser")
feed = soup.find_all("li", "js-stream-item") feed = soup.find_all("li", "js-stream-item")
init = "TWEET={}-{}".format(feed[-1]["data-item-id"], feed[0]["data-item-id"])
return feed, init
def Cont(response): return feed, feed[-1]["data-item-id"]
def Json(response):
json_response = json.loads(response) json_response = json.loads(response)
html = json_response["items_html"] html = json_response["items_html"]
soup = BeautifulSoup(html, "html.parser") soup = BeautifulSoup(html, "html.parser")
feed = soup.find_all("li", "js-stream-item") feed = soup.find_all("li", "js-stream-item")
split = json_response["min_position"].split("-") split = json_response["min_position"].split("-")
split[1] = feed[-1]["data-item-id"] split[1] = feed[-1]["data-item-id"]
return feed, "-".join(split) return feed, "-".join(split)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment