Skip to content

Commit

Permalink
fix: install openai and selenium
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Jul 1, 2024
1 parent 04fcebe commit 9d1128a
Showing 1 changed file with 20 additions and 112 deletions.
132 changes: 20 additions & 112 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": 9,
"execution_count": null,
"id": "4f6774a6-ff96-4c39-87a7-69a1fd3777cc",
"metadata": {
"papermill": {},
Expand All @@ -120,38 +120,34 @@
"import asyncio\n",
"import pandas as pd\n",
"import nest_asyncio\n",
"from openai import OpenAI\n",
"try:\n",
" from openai import OpenAI\n",
"except:\n",
" %pip install openai --user\n",
" from openai import OpenAI\n",
"try:\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",
"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\n",
"try:\n",
" from tiktokdl.download_post import get_post\n",
"except:\n",
" !pip install --user tiktok-dlpy\n",
" !python -m playwright install --with-deps\n",
" from tiktokdl.download_post import get_post"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "5ed8dc04",
"metadata": {},
"outputs": [],
"source": [
" %pip install tiktok-dlpy --user \n",
" %%python -m playwright install --with-deps\n",
" from tiktokdl.download_post import get_post\n",
"nest_asyncio.apply()"
]
},
Expand All @@ -175,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"id": "1a91eab8",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -215,7 +211,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "f40d0a0b",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -259,7 +255,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "60ff8ee3",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -322,7 +318,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "12b372c8",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -353,7 +349,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"id": "e9a0144c",
"metadata": {
"papermill": {},
Expand Down Expand Up @@ -443,101 +439,13 @@
},
{
"cell_type": "code",
"execution_count": 16,
"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",
"Downloading https://www.tiktok.com/@danzabs/video/7383037117007465774 to 7383037117007465774.mp4\n",
"Downloaded https://www.tiktok.com/@danzabs/video/7383037117007465774 to 7383037117007465774.mp4\n",
"Downloading https://www.tiktok.com/@20vc_tok/video/7357026640314043654 to 7357026640314043654.mp4\n",
"Downloaded https://www.tiktok.com/@20vc_tok/video/7357026640314043654 to 7357026640314043654.mp4\n",
"Downloading https://www.tiktok.com/@haileyknox/video/7382280210785357087 to 7382280210785357087.mp4\n",
"Downloaded https://www.tiktok.com/@haileyknox/video/7382280210785357087 to 7382280210785357087.mp4\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",
" <th>url</th>\n",
" <th>transcript</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>https://www.tiktok.com/@danzabs/video/73830371...</td>\n",
" <td>When I wrote Because I Got High, I was ready t...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>https://www.tiktok.com/@20vc_tok/video/7357026...</td>\n",
" <td>But Rippling has done, they have a campaign ri...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>https://www.tiktok.com/@haileyknox/video/73822...</td>\n",
" <td>One, two, one, two. One, two, one, two. One, t...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" url \\\n",
"0 https://www.tiktok.com/@danzabs/video/73830371... \n",
"1 https://www.tiktok.com/@20vc_tok/video/7357026... \n",
"2 https://www.tiktok.com/@haileyknox/video/73822... \n",
"\n",
" transcript \n",
"0 When I wrote Because I Got High, I was ready t... \n",
"1 But Rippling has done, they have a campaign ri... \n",
"2 One, two, one, two. One, two, one, two. One, t... "
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"liked_videos_transcripts = asyncio.run(main(USERNAME, LIMIT))\n",
"liked_videos_transcripts"
Expand All @@ -560,7 +468,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.5"
},
"naas": {
"notebook_id": "35f614b16e2f264d1d38670c7ca5c0fe010e4c1cd828f2812e8a58faaeaee557",
Expand Down

0 comments on commit 9d1128a

Please sign in to comment.