Created
June 20, 2021 11:08
-
-
Save skeltonmod/a349723c83cc62da348ec94a9684741a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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