Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix for wggesucht crawler to only consider the desired listings" #520

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions flathunter/crawler/wggesucht.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,12 @@ def parse_expose_element_to_details(row: Tag, crawler: str) -> Optional[Dict]:


def liste_attribute_filter(element: Union[Tag, str]) -> bool:
"""Return true for elements whose 'id' attribute starts with 'liste-'
and are not contained in the 'premium_user_extra_list' container"""
"""Return true for elements whose 'id' attribute starts with 'liste-'"""
if not isinstance(element, Tag):
return False
if not element.attrs or "id" not in element.attrs:
if "id" not in element.attrs:
return False
if not element.parent or not element.parent.attrs or "class" not in element.parent.attrs:
return False
return element.attrs["id"].startswith('liste-') and \
'premium_user_extra_list' not in element.parent.attrs["class"]
return element.attrs["id"].startswith('liste-')


class WgGesucht(Crawler):
Expand All @@ -179,6 +175,7 @@ def extract_data(self, soup: BeautifulSoup):
e for e in findings
if isinstance(e, Tag) and e.has_attr('class') and not 'display-none' in e['class']
]

for row in existing_findings:
details = parse_expose_element_to_details(row, self.get_name())
if details is None:
Expand Down
Loading