shardul08 / google-trend-wallpaper Goto Github PK
View Code? Open in Web Editor NEWA python and shell script to set the wallpaper to a wordcloud of the most trending google searches.
License: GNU General Public License v3.0
A python and shell script to set the wallpaper to a wordcloud of the most trending google searches.
License: GNU General Public License v3.0
If working on a dual monitor setup, the script considers two screens as one, resulting in a wallpaper that spreads on both screens. an option to set wallpaper on both monitors seperately, or on just one of them would be nice.
With setup.sh, I get ModuleNotFoundError: No module named 'selenium'.
Solved with sudo pip install selenium
... so why doesn't the setup.sh do that?
$ ./setup.sh
Installing Python dependencies...
install ok installed
Installing Pillow...
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (5.4.1)
Installing selenium...
Requirement already satisfied: matplotlib in /home/sander/.local/lib/python3.7/site-packages (3.1.1)
Requirement already satisfied: python-dateutil>=2.1 in /usr/lib/python3/dist-packages (from matplotlib) (2.7.3)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: numpy>=1.11 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (1.17.1)
Requirement already satisfied: cycler>=0.10 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (2.4.2)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from kiwisolver>=1.0.1->matplotlib) (41.1.0)
Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from cycler>=0.10->matplotlib) (1.12.0)
Installing pyvirtualdisplay...
Requirement already satisfied: matplotlib in /home/sander/.local/lib/python3.7/site-packages (3.1.1)
Requirement already satisfied: numpy>=1.11 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (1.17.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: cycler>=0.10 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (2.4.2)
Requirement already satisfied: python-dateutil>=2.1 in /usr/lib/python3/dist-packages (from matplotlib) (2.7.3)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from kiwisolver>=1.0.1->matplotlib) (41.1.0)
Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from cycler>=0.10->matplotlib) (1.12.0)
Creating wallpaper...
Traceback (most recent call last):
File "generateWallpaper.py", line 1, in <module>
from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
Setting wallpaper...
/usr/bin/gsettings
Setup successfully completed
See below. Why not let setup do the pip install pyvirtualdisplay ?
Installing Python dependencies...
install ok installed
Installing Pillow...
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (5.4.1)
Installing pyvirtualdisplay...
Requirement already satisfied: matplotlib in /home/sander/.local/lib/python3.7/site-packages (3.1.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (2.4.2)
Requirement already satisfied: cycler>=0.10 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in /usr/lib/python3/dist-packages (from matplotlib) (2.7.3)
Requirement already satisfied: numpy>=1.11 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (1.17.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/sander/.local/lib/python3.7/site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from cycler>=0.10->matplotlib) (1.12.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from kiwisolver>=1.0.1->matplotlib) (41.1.0)
Creating wallpaper...
Traceback (most recent call last):
File "generateWallpaper.py", line 2, in <module>
from pyvirtualdisplay import Display
ModuleNotFoundError: No module named 'pyvirtualdisplay'
Setting wallpaper...
/usr/bin/gsettings
Setup successfully completed
solution:
sander@witte:~/git/Google-Trend-Wallpaper$ sudo pip3 install pyvirtualdisplay
WARNING: The directory '/home/sander/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/sander/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pyvirtualdisplay
Downloading https://files.pythonhosted.org/packages/cf/ad/b15f252bfb0f1693ad3150b55a44a674f3cba711cacdbb9ae2f03f143d19/PyVirtualDisplay-0.2.4-py2.py3-none-any.whl
Collecting EasyProcess (from pyvirtualdisplay)
Downloading https://files.pythonhosted.org/packages/fa/29/40040d1d64a224a5e44df9572794a66494618ffe5c77199214aeceedb8a7/EasyProcess-0.2.7-py2.py3-none-any.whl
Installing collected packages: EasyProcess, pyvirtualdisplay
Successfully installed EasyProcess-0.2.7 pyvirtualdisplay-0.2.4
sander@witte:~/git/Google-Trend-Wallpaper$
Hello, I have troubles to get it working on Mojave. I installed geckodriver yet I am still getting errors. With sudo and without sudo, same:
janbenes@Jans-Mac ~/Google-Trend-Wallpaper> brew install geckodriver
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/geckodriver-0.24.0.mojave.bottle.tar.gz
Already downloaded: /Users/janbenes/Library/Caches/Homebrew/downloads/8ab92ea1151f5b108dc35c68f6fe616f20414cf6ab7099e42f58b8dbfb169b6a--geckodriver-0.24.0.mojave.bottle.tar.gz
==> Pouring geckodriver-0.24.0.mojave.bottle.tar.gz
๐บ /usr/local/Cellar/geckodriver/0.24.0: 7 files, 5.9MB
janbenes@Jans-Mac ~/Google-Trend-Wallpaper> sudo ./updateWallpaper.sh
Creating wallpaper...
ERROR: Install geckodriver, and make sure it's in your PATH
Something went wrong
You can raise an issue at https://github.com/shardul08/Google-Trend-Wallpaper/issues
generated wallpapers can be an eyesore behind desktops with lots of icons. a dimming option, such as adding a gray transparent layer on top might make them more useful.
ISO 3166 country codes for India and Canada work, fails for Pakistan with:
$ ./updateWallpaper.sh
Creating wallpaper...
Traceback (most recent call last):
File "generateWallpaper.py", line 23, in <module>
link_div = browser.find_element_by_xpath("/html/body/div[2]/div[2]/div/div[2]/div/div[{}]".format(k))
File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: /html/body/div[2]/div[2]/div/div[2]/div/div[2]
Setting wallpaper...
/usr/bin/gsettings
$ ./updateWallpaper.sh
Creating wallpaper...
Traceback (most recent call last):
File "generateWallpaper.py", line 11, in <module>
browser = webdriver.Firefox()
File "/usr/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
Setting wallpaper...
/usr/bin/gsettings
With geckodriver not yet installed, I got the hard core error below.
So why not put a try-except around browser = webdriver.Firefox()
and exit on an except.
I can send a PR if you want.
sander@witte:~/git/Google-Trend-Wallpaper$ ./setup.sh
Installing Python dependencies...
install ok installed
Installing Pillow...
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (5.4.1)
Creating wallpaper...
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver': 'geckodriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "generateWallpaper.py", line 11, in <module>
browser = webdriver.Firefox()
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
Setting wallpaper...
/usr/bin/gsettings
Setup successfully completed
sander@witte:~/git/Google-Trend-Wallpaper$
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.