Skip to content

Commit

Permalink
fix: install missing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Jul 2, 2024
1 parent 9d1128a commit d901eb7
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 135 deletions.
137 changes: 11 additions & 126 deletions TikTok/TikTok_Get_liked_videos.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "4f6774a6-ff96-4c39-87a7-69a1fd3777cc",
"metadata": {
"papermill": {},
Expand All @@ -125,15 +125,16 @@
" from selenium.webdriver.support.ui import WebDriverWait\n",
" from selenium.webdriver.support import expected_conditions as EC\n",
"except:\n",
" !pip install --user PyTikTokAPI\n",
" %pip install selenium --user\n",
" %pip install PyTikTokAPI --user\n",
" from selenium import webdriver\n",
" from selenium.webdriver.common.by import By\n",
" from selenium.webdriver.support.ui import WebDriverWait\n",
" from selenium.webdriver.support import expected_conditions as EC\n",
"try:\n",
" from bs4 import BeautifulSoup\n",
"except:\n",
" !pip install --user beautifulsoup4\n",
" %pip install beautifulsoup4 --user\n",
" from bs4 import BeautifulSoup"
]
},
Expand All @@ -156,7 +157,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"id": "1a91eab8",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -195,7 +196,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": null,
"id": "f40d0a0b",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -239,7 +240,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": null,
"id": "60ff8ee3",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -289,7 +290,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"id": "e9a0144c",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -359,129 +360,13 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": null,
"id": "08eaaac0",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Navigated to https://www.tiktok.com/@jeremyravenel\n",
"Clicked on Liked tab successfully\n",
"Scroll 1/10 completed\n",
"Scroll 2/10 completed\n",
"Scroll 3/10 completed\n",
"Scroll 4/10 completed\n",
"Scroll 5/10 completed\n",
"Scroll 6/10 completed\n",
"Scroll 7/10 completed\n",
"Scroll 8/10 completed\n",
"Scroll 9/10 completed\n",
"Scroll 10/10 completed\n",
"Found 267 videos\n",
"Data saved to jeremyravenel_liked_videos.csv\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>url</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>https://www.tiktok.com/@haileyknox/video/73822...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>https://www.tiktok.com/@andrew_ships/video/736...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>https://www.tiktok.com/@courtney..johnson/vide...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>https://www.tiktok.com/@refugespirituel/video/...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>https://www.tiktok.com/@lesechosstart/video/73...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>95</th>\n",
" <td>https://www.tiktok.com/@bazolabaze/video/72512...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>96</th>\n",
" <td>https://www.tiktok.com/@rileybrown.ai/video/72...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>97</th>\n",
" <td>https://www.tiktok.com/@gianluca.mauro/video/7...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>98</th>\n",
" <td>https://www.tiktok.com/@kayawittenburg/video/7...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>99</th>\n",
" <td>https://www.tiktok.com/@lexfridman/video/72441...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>100 rows × 1 columns</p>\n",
"</div>"
],
"text/plain": [
" url\n",
"0 https://www.tiktok.com/@haileyknox/video/73822...\n",
"1 https://www.tiktok.com/@andrew_ships/video/736...\n",
"2 https://www.tiktok.com/@courtney..johnson/vide...\n",
"3 https://www.tiktok.com/@refugespirituel/video/...\n",
"4 https://www.tiktok.com/@lesechosstart/video/73...\n",
".. ...\n",
"95 https://www.tiktok.com/@bazolabaze/video/72512...\n",
"96 https://www.tiktok.com/@rileybrown.ai/video/72...\n",
"97 https://www.tiktok.com/@gianluca.mauro/video/7...\n",
"98 https://www.tiktok.com/@kayawittenburg/video/7...\n",
"99 https://www.tiktok.com/@lexfridman/video/72441...\n",
"\n",
"[100 rows x 1 columns]"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"liked_videos = main(USERNAME, LIMIT)\n",
"liked_videos"
Expand All @@ -504,7 +389,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.5"
},
"naas": {
"notebook_id": "35f614b16e2f264d1d38670c7ca5c0fe010e4c1cd828f2812e8a58faaeaee557",
Expand Down
99 changes: 90 additions & 9 deletions TikTok/TikTok_Get_liked_videos_transcripts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "4f6774a6-ff96-4c39-87a7-69a1fd3777cc",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -171,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "1a91eab8",
"metadata": {
"papermill": {},
Expand All @@ -181,7 +181,7 @@
"source": [
"#Mandatory\n",
"USERNAME = '<username>'\n",
"OPENAI_API_KEY = '<your-openai-api-key>'\n",
"OPENAI_API_KEY = '<openai_api_key>'\n",
"\n",
"#Optional\n",
"LIMIT = 3"
Expand Down Expand Up @@ -211,7 +211,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "f40d0a0b",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -255,7 +255,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "60ff8ee3",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -318,7 +318,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "12b372c8",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -349,7 +349,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "e9a0144c",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -439,13 +439,94 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "08eaaac0",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Navigated to https://www.tiktok.com/@jeremyravenel\n",
"Failed to click on Liked tab: Message: element click intercepted: Element <p aria-selected=\"false\" role=\"tab\" data-e2e=\"liked-tab\" tabindex=\"0\" class=\"css-r7ao4-PLike e1jjp0pq4\">...</p> is not clickable at point (409, 330). Other element would receive the click: <div class=\"sc-fjdhpX klIBjd\">...</div>\n",
" (Session info: chrome=126.0.6478.127)\n",
"Stacktrace:\n",
"\tGetHandleVerifier [0x00007FF7116EEEA2+31554]\n",
"\t(No symbol) [0x00007FF711667ED9]\n",
"\t(No symbol) [0x00007FF71152872A]\n",
"\t(No symbol) [0x00007FF71158012E]\n",
"\t(No symbol) [0x00007FF71157DAF2]\n",
"\t(No symbol) [0x00007FF71157AF8B]\n",
"\t(No symbol) [0x00007FF71157A156]\n",
"\t(No symbol) [0x00007FF71156C151]\n",
"\t(No symbol) [0x00007FF71159D02A]\n",
"\t(No symbol) [0x00007FF71156BA76]\n",
"\t(No symbol) [0x00007FF71159D240]\n",
"\t(No symbol) [0x00007FF7115BC977]\n",
"\t(No symbol) [0x00007FF71159CDD3]\n",
"\t(No symbol) [0x00007FF71156A33B]\n",
"\t(No symbol) [0x00007FF71156AED1]\n",
"\tGetHandleVerifier [0x00007FF7119F8B1D+3217341]\n",
"\tGetHandleVerifier [0x00007FF711A45AE3+3532675]\n",
"\tGetHandleVerifier [0x00007FF711A3B0E0+3489152]\n",
"\tGetHandleVerifier [0x00007FF71179E776+750614]\n",
"\t(No symbol) [0x00007FF71167375F]\n",
"\t(No symbol) [0x00007FF71166EB14]\n",
"\t(No symbol) [0x00007FF71166ECA2]\n",
"\t(No symbol) [0x00007FF71165E16F]\n",
"\tBaseThreadInitThunk [0x00007FFB2C66257D+29]\n",
"\tRtlUserThreadStart [0x00007FFB2E62AF28+40]\n",
"\n",
"Found 4 videos\n",
"Error extracting video info: 'NoneType' object is not subscriptable\n",
"Error extracting video info: 'NoneType' object is not subscriptable\n",
"Error extracting video info: 'NoneType' object is not subscriptable\n",
"Error extracting video info: 'NoneType' object is not subscriptable\n",
"Data saved to jeremyravenel_liked_videos_transcripts.csv\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"Empty DataFrame\n",
"Columns: []\n",
"Index: []"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"liked_videos_transcripts = asyncio.run(main(USERNAME, LIMIT))\n",
"liked_videos_transcripts"
Expand Down

0 comments on commit d901eb7

Please sign in to comment.