Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2a9c700d9 |
+161
-4
@@ -1,5 +1,162 @@
|
||||
driver
|
||||
venv
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
html
|
||||
imgs
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Additional permission under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or combining it with [name of library] (or a modified version of that library), containing parts covered by the terms of [name of library's license], the licensors of this Program grant you additional permission to convey the resulting work. Corresponding Source for a non-source form of such a combination shall include the source code for the parts of [name of library] used as well as that of the covered work.
|
||||
@@ -1,64 +0,0 @@
|
||||
from fake_useragent import UserAgent
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver import Firefox
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.firefox.service import Service
|
||||
from selenium.webdriver.firefox.options import Options
|
||||
import time
|
||||
from datetime import date, datetime
|
||||
import os
|
||||
import codecs
|
||||
|
||||
|
||||
now = datetime.now()
|
||||
formatingDate = now.strftime("%d-%m-%Y-%H-%M")
|
||||
|
||||
basePath = "D:\Programming\PythonProgects\PinterestParse\html"
|
||||
|
||||
ua = UserAgent(use_cache_server=False)
|
||||
#useragent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
|
||||
#useragent=ua
|
||||
|
||||
firefoxProfie = r'C:\\Users\\danamir.ASUMADI\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\9vfgbpct.default'
|
||||
options=Options()
|
||||
options.set_preference('profile',firefoxProfie)
|
||||
driverPath = os.getcwd()+'\driver\geckodriver.exe'
|
||||
service = Service(driverPath)
|
||||
browser = Firefox(service=service, options=options)
|
||||
|
||||
url = "https://ru.pinterest.com/alexdanamir/%D1%87%D0%B5%D1%80%D1%82%D0%B5%D0%B6%D0%B8/"
|
||||
|
||||
browser.get(url)
|
||||
|
||||
|
||||
SCROLL_PAUSE_TIME = 5
|
||||
|
||||
# Get scroll height
|
||||
last_height = browser.execute_script("return document.body.scrollHeight")
|
||||
|
||||
while True:
|
||||
# Scroll down to bottom
|
||||
browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
|
||||
|
||||
# Wait to load page
|
||||
time.sleep(SCROLL_PAUSE_TIME)
|
||||
|
||||
# Calculate new scroll height and compare with last scroll height
|
||||
new_height = browser.execute_script("return document.body.scrollHeight")
|
||||
if new_height == last_height:
|
||||
break
|
||||
last_height = new_height
|
||||
|
||||
html = browser.page_source
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
htmlName = "pinterest" + "-" + formatingDate + ".txt"
|
||||
saveFile = os.path.join(basePath, htmlName)
|
||||
|
||||
savedFile = open(saveFile, "w")
|
||||
savedFile.write(html)
|
||||
savedFile.close()
|
||||
browser.close()
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import re
|
||||
import os
|
||||
import logging
|
||||
|
||||
def main():
|
||||
|
||||
logging.basicConfig(filename='app.log', level=logging.DEBUG)
|
||||
|
||||
basePath = "D:\Programming\PythonProgects\PinterestParse\html"
|
||||
|
||||
fileForParse = os.path.join(basePath,os.listdir(basePath)[0])
|
||||
|
||||
logging.debug(fileForParse)
|
||||
|
||||
openedFile = open(fileForParse, 'r')
|
||||
|
||||
logging.debug(openedFile.read().decode('cp-1251'))
|
||||
|
||||
|
||||
|
||||
if __name__ =='__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user