114 lines
2.6 KiB
Plaintext
114 lines
2.6 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from selenium.webdriver.common.by import By\n",
|
|
"# import requests\n",
|
|
"# import pyperclip\n",
|
|
"from selenium_scraper import Twitter\n",
|
|
"from datetime import timedelta, datetime\n",
|
|
"from classes import Tweet\n",
|
|
"import traceback\n",
|
|
"import logging\n",
|
|
"from database import connect_mongo\n",
|
|
"\n",
|
|
"account = 'Maersk'\n",
|
|
"until_year = 2010"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"0"
|
|
]
|
|
},
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# reset database\n",
|
|
"db = connect_mongo()\n",
|
|
"# db.drop()\n",
|
|
"db.count_documents({'account':f'@{account}'})"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"ERROR:root:failed extracting post url\n",
|
|
"WARNING:root:retrying later due to error getting period: [2023-02-23 00:00:00:2023-03-05 00:00:00]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"from selenium_scraper import scrape_account\n",
|
|
"\n",
|
|
"scrape_account(account, until_year)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "venv",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.10.6"
|
|
},
|
|
"orig_nbformat": 4,
|
|
"vscode": {
|
|
"interpreter": {
|
|
"hash": "1d532f3642617da00cbdbdc5ef98bd8d4ca226c95ac593ade79d8cbc880a2afe"
|
|
}
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|