isanchop / stuhack Goto Github PK
View Code? Open in Web Editor NEWChrome extension for studocu premium free
Chrome extension for studocu premium free
While the preview of the document to be downloaded is displayed correctly in the new tab, printing to PDF does not render correctly.
One image plus one quarter of the next image are printed on the same page.
Eliminating the margins and increasing the scale to 120% gives an acceptable result.
I absolutely love it! Would it be possible to make it work on different domains as well? For example, in the Netherlands its called studeersnel.nl instead of studocu.com because its originally a Dutch website (:
When trying to click on StuHack extension drop down menu, it shows that ,
**404. That’s an error.
The requested URL was not found on this server. That’s all we know.**
When I click to download doesn't open the other tab to ctrl+p save. It just pop up to upgrade studocu. I tried to remove and reinstall other browser but nothing
Hi, sometimes ago i notice that all pdf i try to downlod present some imperfection like: word trasparent or part of html from the original document (like the Premium Banner ) inside the pdf. How i can fix that?
I would also say this tool is very useful, so good job guys @isanchop @Pradeep1409
Thank you for savin my life kind soul.
God bless!
There's been a new update with Chrome, and whenever I try to open Studocu, the screen goes blank after a few seconds.
To exchange the idea and for enlighten the discussion, I purpose a potential way to resolve this issue. I have no intention to infringe any rules. The blur effect is base on monitoring the CSS of page-content, in this way any change to the page-content style will lead to a overwrite to the style. However, there is no monitor of the sub-div. You may run the code in console to validate the effectiveness.
Before
After
If the document has multiple pages, remember to scroll all the way down before execute the code. Otherwise, due to the pages are loaded when you read them, the script will not be able to remove blur before it's loaded from server.
// Remove Blur
const blurNodes = document.querySelectorAll('.page-content');
for (let i = 0; i < blurNodes.length; i++) {
if (blurNodes[i].hasChildNodes() && blurNodes[i].style["filter"] != "") {
console.log("[Info] Processing Page", i+1, "...")
myDiv = blurNodes[i].firstChild;
if (myDiv.firstChild.nodeName == 'IMG') {
console.log("[Failed] Page", i+1, "is an image.")
} else {
blurNodes[i].parentNode.append(myDiv);
blurNodes[i].removeChild(blurNodes[i].firstChild);
console.log("[Success] Removed Blur on Page", i)
}
}
}
// Remove Notices
const bannerNodesA = document.querySelectorAll('.banner-wrapper');
for (let i = 0; i < bannerNodesA.length; i++) {
bannerNodesA[i].parentNode.removeChild(bannerNodesA[i]);
}
const bannerNodesB = document.querySelectorAll('._60e676a00207');
for (let i = 0; i < bannerNodesB.length; i++) {
bannerNodesB[i].parentNode.removeChild(bannerNodesB[i]);
}
const blurNotice = document.querySelectorAll('._869f7c361ca9');
for (let i = 0; i < blurNotice.length; i++) {
blurNotice[i].parentNode.removeChild(blurNotice[i]);
}
seems that triple-click to download doesn't work.
is there the possibility to unblur the page now that they add this new feature that we cant see some pages?
-Premium banner remove (works)
-Blur pass (works)
-Documents download (how does it work?)
I installed the extension with the zip file following the instructions in the readme.md
1) Git clone or download file and unzip on a folder 2) Go to the extensions tab on google chrome (chrome://extensions/) 3) Enable "Developer mode" on the top right of the tab 4) Press on "Load unpacked" new feature that appeared on top left corner 5) Browse the path you downloaded the extension and choose select 6) Enjoy :)
After clicking developer mode and clicking 'Load unpack' i got this error message,
Failed to load extension
File
~\Downloads\stuhack
Error
Manifest file is missing or unreadable
Could not load manifest`
I've tried deleting and redownloading the zip file but to no avail, any idea what could be happening?
After I downloaded the extension on chrome, how do I use it to download the documents? I still have the premium blocks on my web. I can't click on the chrome extension on the document viewing page.
The download button is not working. I found it's because the array prev_buttons
in the file doc-viewer.js has only 2 elements and the code is accessing position 2 and 3, so it crashes.
Removing this two lines solves the issue:
prev_buttons[2].parentNode.parentNode.prepend(button2);
prev_buttons[3].parentNode.parentNode.removeChild(prev_buttons[3].parentNode);
I guess there's only two buttons now.
Seems like Studocu has figured out how to place a large banner when printing files to PDF.
Fortunately the notes are still visible on the web, but the PDF will have a large banner on some (but not all) of the pages. I have attached a 3-page document as an example. The banner is on pg. 3.
A larger document it starts at pg. 3 and then shows up on alternating pages.
Procedural Fairness.pdf
Hello, appreciate all your hard work.
Just wanted to note, that the text has now become greyed out by default instead of the original black font colour when saving documents.
Hi i got an error and the extension is greyed out
Uncaught TypeError: Cannot read properties of undefined (reading 'parentNode')
Stack Trace
version-check.js:13 (anonymous function)
This line was highlighted in chrome:
up_buttons[0].parentNode.parentNode.insertBefore(button_cv, up_buttons[0].parentNode.parentElement.children[3]);
Stack Trace
remove-banner.js:10 (anonymous function)
This line was also highlighted:
premiumButton.parentNode.removeChild(premiumButton);
Good morning, first of all thanks for your work! However i have a problem. When i'm on studocu and i click to "download" it redirects me on the website that ask me to have a Premium Account. Why? Thanks!
Hi guys, i happen to bump into some issues i'd like to talk about:
(notably the errors occur mostly at the end of some pages)
I hope you guys can fix this soon. Thank you !
Hi,
Thank you for you work, i love your extension, but with the version 0.4.5 the button download don't work.
I see all the document without blur, but i can't download it.
I hope you will fix it,
Thank you!
Hello, thanks for doing this project. Can you write a userscript version? Thank you very much
Hello
I am attempting to print a 8-page document, but when I try print to PDF it only prints the first page and the other 7 pages are blank.
In the preview I am able to see all the other pages and the text just not print them with the text.
Please help :(
Chrome cannot identify the working files in the extensions tab. Please update.
Hey, when I press on the download button nothing happens, no popup at all.
Using the 0.4.5 Version under chrome
I got a 241 page document and when i click download a new page pops up with the document. However i dont know if theres a way to download the document or do I have to download all 241 pages one at a time?
To download documents larger than 20 pages you have to first load the full page scrolling down till the end of the document
Hi,
Stuhack is one of the best things a student can have and I'm really grateful for it! There is no problem and everything is working perfectly. I just had a question and I didn't know how to contact you. I'm from Belgium and although Studocu is also a big platform here, we mainly use another website called stuvia.be . The way the website works is a bit different than Studocu, you pay per item you want to download instead of a fixed price per month. I was wondering if you would be interested in making a similar tool as Stuhack for stuvia.be. If you are interested, please let me know so we can look into this. I would also have no problem paying you for it! Hope to hear from you soon.
Hi
Just installed this, when i click download there's a popup saying ''Download this document?
Upload your study materials to download all documents.'' "Upload to unlock documents''
So not sure what to do, thought the extension removes the popup
Hello! Thanks for your work.
But I have a problem, when I add the extension to chrome there is an error about manifest and it doesn't work. It says "Manifest version 2 is deprecated, and support will be removed in 2023."
Is there anything you can do about this?
Some documents implement blurred images (https://d3tvd1u91rr79.cloudfront.net/a2aa9a4720ce8e5692f963a70e3cfcc9/html/pages/blurred/page3.webp...
). This can be bypassed simply by removing the /blurred/
from the Cloudfront URL.
This means that the StuHack extension does not work for these documents, since StuHack currently relies on client-side blurring with the CSS style filter: blur(2px)
and simply undoing that blurring. I wrote a Python script that when given a URL, it will save the document as a PDF by identifying the Cloudfront CDN URL and constructing a non-blurred URL path.
from typing import List, Tuple
import requests
from PIL import Image
from io import BytesIO
import re
def get_total_pages(document_link: str) -> int:
r = requests.get(document_link, headers={"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9"})
regex = r'data-page-no=\\\"([0-9a-f]+)\\\"'
matches = re.findall(regex, r.text, re.IGNORECASE)
total_pages = max(int(match, 16) for match in matches)
return total_pages
def get_image_info(document_link: str) -> Tuple[str, str, str]:
r = requests.get(document_link, headers={"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9"})
regex = r'src="https://(?P<subdomain>[\w.-]+)\.cloudfront\.net/(?P<identifier>[\w.-]+)/html/bg1\.png\?Policy=(?P<policy>[^"]+)"'
matches = re.search(regex, r.text, re.IGNORECASE)
if matches:
subdomain = matches.group("subdomain")
identifier = matches.group("identifier")
policy = matches.group("policy").replace("&", "&")
return subdomain, identifier, policy
else:
raise ValueError("Image information not found in the document link.")
def download_images(subdomain: str, identifier: str, policy: str, total_pages: int) -> List[Image.Image]:
images = []
for i in range(1, total_pages + 1):
url = f"https://{subdomain}.cloudfront.net/{identifier}/html/pages/page{i}.webp?Policy={policy}"
r = requests.get(url, allow_redirects=True)
try:
images.append(Image.open(BytesIO(r.content)))
except Exception as e:
raise ValueError(f"Failed to download page {i}. Looks like this document is using client-side blurring-- try using the StuHack Chrome extension instead.")
print(f"[~] Downloaded page {i} of {total_pages}")
return images
def save_document(output_file: str, images: List[Image.Image]) -> None:
if images:
images[0].save(output_file, save_all=True, append_images=images[1:])
print(f"[+] Document saved to {output_file}")
else:
raise ValueError("No images found.")
def main() -> None:
document_link = input("Enter the link to the document: ")
if "studocu" not in document_link:
print("Invalid link")
return
output_file = input("Enter the output file name (e.g., output.pdf): ")
try:
total_pages = get_total_pages(document_link)
print(f"[+] Identified {total_pages} pages in the document.")
subdomain, identifier, policy = get_image_info(document_link)
images = download_images(subdomain, identifier, policy, total_pages)
save_document(output_file, images)
except Exception as e:
print(f"[-] An error occurred: {e}")
if __name__ == "__main__":
main()
You'll need to install requests, Pillow, and typing.
pip install requests pillow typing
Thought I would leave this here for whoever needs it, since I know there are a few issues open regarding the extension not working.
TL;DR
filter: blur(2px)
I was thinking of making a PR to help integrate this into StuHack, but my Javascript knowledge is pretty lacking. I also don't know my way around a lot of the Web API stuff and noticed there's some things StuDocu does like if the filter: blur(2px)
gets removed, it gets added back. Figured some folks smarter than me could implement my logic into the extension to make it support both types of documents.
I cant see them anymore
some docs will only download the background images
I tried printing a document in landscape mode, but chrome didn't provide the option.
I found this thread suggesting using the style
@page {
size: auto;
}
The option for the landscape mode shows up when applied as described in the linked post.
Here you are using the style
@page {
size: A5;
}
, which currently doesn't work.
Should I open a pull request or is there a reason for A5 being used as size?
Top right Download button is inactive and gives an error in Chrome extensions
up_buttons[0].parentNode.parentNode.insertBefore(button_cv, up_buttons[0].parentNode.parentElement.children[3]);
Hi, I downloaded the last version (v0.5.5) but the blurred images fix isn't working for me
Hi, when i open a document some pages got blurred, can you fix that please? thanks!
Hey,
I downloaded the latest version, installed it in Chrome and unfortunately it doesn't work. (In print menu only headings no content visible).
I have read through the old discussions and examined the code after the adjustments and could not find any error.
So I tried the add-on while I was logged in and even if not.
Is there any other source of error I could investigate or is the site more up to date than the add-on?
Chrome on Win 10 Version 109.0.5414.75 (Official Build) (64-bit)
It is now only working for 2/3 pages, it is an amazing tool, please fix as soon as possible. Thank you!
As the title says, I cannot save the files as pdf after opening them on the page after clicking on download.
The page opens, continues in an endless loading and then crashes in "out of memory" error page, I have tried on different computers but get the same result.
The problem that was present in 0.4.6 that only displayed the first page has disappeared.
Excellent work, keep going!
Premium banners stay at the top of the page and parts of the page stay blurred, extension gives an error
"Cannot read properties of null (reading 'childNodes')" in removebanner.js line 2
Is there a way for this to work on android?
whenever i save a file then checking it, i noticed some unnnecessary stuff on every page like the text content at the bottom page got cropped and the text content from the next page got included
8 In class Tutorial Questions & Solutions Business Combinations & Consolidations.pdf
see file for more understanding thanks admin
Hello I cannot download PDF file, it opens on a separate window which allows me to view the document but when i hit print, I cannot scale to full page PDF.
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.