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

fix(coloctapp): update cleanup_content #1216

Merged
merged 2 commits into from
Oct 21, 2024
Merged

fix(coloctapp): update cleanup_content #1216

merged 2 commits into from
Oct 21, 2024

Conversation

grossir
Copy link
Contributor

@grossir grossir commented Oct 21, 2024

Solves:
#1215

We are getting duplicate hashes again due to some documents having multiple hash altering elements. Generalize cleanup_content to cases with more than one element

@grossir grossir requested a review from flooie October 21, 2024 16:37
Solves: #1215

We are getting duplicate hashes again due to some documents having multiple hash altering elements. Generalize cleanup_content to cases with more than one element

for tag in tree.xpath("//*[@class]"):
tag.attrib.pop("class")
remove_tags = ["//style", "//img"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this - perhaps we should modify
from juriscraper.lib.html_utils import strip_bad_html_tags_insecure

or some similar function to pass in extra tags we want to remove using Nh3 ?

Comment on lines +40 to +47
remove_tags = ["//style", "//img"]
remove_attributes = [
"//*[@class]",
# contains json like data with "ctm" key
"//*[@data-data]",
# contains coordinate like data
"//*[@data-dest-detail]",
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible we might want to leave some of these classes in so we can use them to improve how tresults display on CL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im starting to think we should look at the few HTML scrapers and tailor some CSS for them

@flooie flooie merged commit 1d47cc6 into main Oct 21, 2024
12 checks passed
@flooie flooie deleted the clean_coloctapp_content branch October 21, 2024 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants