Skip to content

Instantly share code, notes, and snippets.

@skeltonmod
Created June 20, 2021 11:08
Show Gist options
  • Save skeltonmod/a349723c83cc62da348ec94a9684741a to your computer and use it in GitHub Desktop.
Save skeltonmod/a349723c83cc62da348ec94a9684741a to your computer and use it in GitHub Desktop.
def crawl(tracking):
content = list()
if tracking is not None:
b64 = base64.b64encode(tracking.encode('ascii')).decode('ascii')
response = requests.get(f"https://www.lbcexpress.com/track/{b64}").content
soup = BeautifulSoup(response, "html.parser")
status = [x.get_text() for x in soup.find_all(class_='status-tracking')]
time = [z.get_text() for z in soup.find_all(class_='date-track-a')]
content.append({'status': status, 'time': time})
else:
content.append({'status': "", 'time': ""})
print(content)
return content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment