mirror of
https://github.com/heyarne/bookmarks-to-kml.git
synced 2026-05-06 18:43:40 +02:00
fix user_agent name
This commit is contained in:
parent
56786ac11e
commit
ec32a54fae
2 changed files with 6 additions and 5 deletions
|
|
@ -15,7 +15,7 @@ import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
coords_in_content = re.compile('\/@(-?\d+\.\d+),(-?\d+\.\d+),')
|
coords_in_content = re.compile('\/@(-?\d+\.\d+),(-?\d+\.\d+),')
|
||||||
mobile_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36'
|
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36'
|
||||||
|
|
||||||
filename = r'GoogleBookmarks.html'
|
filename = r'GoogleBookmarks.html'
|
||||||
if(len(sys.argv) > 1):
|
if(len(sys.argv) > 1):
|
||||||
|
|
@ -28,7 +28,7 @@ with open(filename) as bookmarks_file:
|
||||||
doc = document_fromstring(data)
|
doc = document_fromstring(data)
|
||||||
|
|
||||||
class Browser(FancyURLopener):
|
class Browser(FancyURLopener):
|
||||||
version = mobile_agent
|
version = user_agent
|
||||||
|
|
||||||
for label in doc.body.iterfind('dl/dt/h3'):
|
for label in doc.body.iterfind('dl/dt/h3'):
|
||||||
labelName = label.text_content()
|
labelName = label.text_content()
|
||||||
|
|
@ -62,7 +62,7 @@ for label in doc.body.iterfind('dl/dt/h3'):
|
||||||
longitude = coords[1]
|
longitude = coords[1]
|
||||||
|
|
||||||
except (AttributeError, IndexError):
|
except (AttributeError, IndexError):
|
||||||
print('[Coordinates not found] ' + str(coords) + ' Try to update "mobile_agent"')
|
print('[Coordinates not found: ' + str(coords) + '. Try to update "user_agent"]')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print(latitude, longitude)
|
print(latitude, longitude)
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,9 @@ Go to Google Bookmarks: https://www.google.com/bookmarks/
|
||||||
On the bottom left, click "Export bookmarks": https://www.google.com/bookmarks/bookmarks.html?hl=en
|
On the bottom left, click "Export bookmarks": https://www.google.com/bookmarks/bookmarks.html?hl=en
|
||||||
|
|
||||||
Install script dependencies:
|
Install script dependencies:
|
||||||
pip install simplekml lxml
|
pip3 install simplekml lxml
|
||||||
|
|
||||||
After downloading the html file, run this script on it to generate a KML file per bookmark label.
|
After downloading the html file, run this script on it to generate a KML file per bookmark label:
|
||||||
|
python3 bookmarkstokml.py GoogleBookmarks.html
|
||||||
|
|
||||||
It's hacky and doesn't work on all of them, but it kinda works.
|
It's hacky and doesn't work on all of them, but it kinda works.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue