5
5
import re
6
6
import enum
7
7
import os
8
- import urllib .parse as urlparse
8
+ from urllib .parse import urlparse , parse_qs
9
9
from pycaching import errors
10
10
from pycaching .geo import Point
11
11
from pycaching .trackable import Trackable
@@ -616,9 +616,9 @@ def load(self):
616
616
617
617
# details not avaliable for basic members for PM only caches ------------------------------
618
618
619
- parsed_url = urlparse (root .find (id = "ctl00_ogUrl " ).get ("content " ))
620
- query_string = urlparse . parse_qs (parsed_url )
621
- self .guid = query_string ['guid' ]
619
+ parsed_url = urlparse (root .find ("link" , rel = "canonical " ).get ("href " ))
620
+ query_string = parse_qs (parsed_url . query )
621
+ self .guid = query_string ['guid' ][ 0 ]
622
622
623
623
pm_only_warning = root .find ("p" , "Warning NoBottomSpacing" )
624
624
self .pm_only = pm_only_warning and ("Premium Member Only" in pm_only_warning .text ) or False
@@ -754,7 +754,8 @@ def load_by_guid(self):
754
754
hidden_p = content .find ("p" , text = re .compile ("Placed Date:" ))
755
755
self .hidden = hidden_p .text .replace ("Placed Date:" , "" ).strip ()
756
756
757
- attr_img = content .find_all ("img" , src = re .compile ("\/attributes\/" ))
757
+ attributes_widget = content .find ("div" , "sortables" )
758
+ attr_img = attributes_widget .find_all ("img" , src = re .compile ("\/attributes\/" ))
758
759
attributes_raw = [
759
760
os .path .basename (_ .get ("src" )).rsplit ("-" , 1 ) for _ in attr_img
760
761
]
@@ -771,8 +772,8 @@ def load_by_guid(self):
771
772
772
773
self .hint = content .find (id = "uxEncryptedHint" ).text
773
774
774
- self . favorites = content .find (
775
- "strong" , text = re . compile ( "Favorites:" )) .parent .text .split ()[- 1 ]
775
+ favorites = content .find ("strong" , text = re . compile ( "Favorites:" ))
776
+ self . favorites = 0 if favorites is None else int ( favorites .parent .text .split ()[- 1 ])
776
777
777
778
self .waypoints = Waypoint .from_html (content , "Waypoints" )
778
779
0 commit comments