Pixiv | Get image from pixiv | Computer Vision library
kandi X-RAY | Pixiv Summary
kandi X-RAY | Pixiv Summary
Python3; Get image from pixiv.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- This is the main function for multi_data
- Get a list of items from a user
- List items in folder
- Wrapper for http requests
- Print image data
- Write image data
- Return the image url
- Get data by item
- Sort data
Pixiv Key Features
Pixiv Examples and Code Snippets
Community Discussions
Trending Discussions on Pixiv
QUESTION
ANSWER
Answered 2020-Dec-02 at 22:47Sometimes websites won't let you load images without proper a referrer.
Yes. Plenty of websites do not want to pay to store images and transfer them over the network so that freeloaders can display them on their websites without shouldering the cost.
In a similar question I have found this answer, that suggests doing something like this
That fails for two reasons.
- It is a forbidden header. Browsers are designed to prevent your JavaScript from lying about where requests are being triggered from.
- Most sites hosting images don't grant permission, via CORS, to third-parties to read them with JS. They are even more unlikely to if they do referer checking to stop freeloading!
If a website doesn't want you displaying images they host, you need to respect that.
Pay for your own image hosting instead.
Don't copy the images from the third-party to your own site unless you are sure they aren't protected by copyright (or you have permission).
QUESTION
I added a print to the "discriminator_loss" function to see what was going on. at first it will tell me the shape of both are 16. later it tells me the shape of "real_loss" is only 15 while the other stays 16. So far I have only tried lowering the batchsize's and increasing them by 1 ect. I have provided the most relevant parts of the code. I can provide the rest of the code if needed. I have no clue why this is happening and it breaks the code.
...ANSWER
Answered 2020-Sep-13 at 08:14So according to comments the problem lies in unequal batch sizes, due to the final batch being smaller than the specified batch size. I believe this is due to this line:
QUESTION
I was making a image downloading project for a website, but I encountered some strange behavior using tqdm. In the code below I included two options for making the tqdm progress bar. In option one I did not passed the iteratable content from response into the tqdm directly, while the second option I did. Although the code looks similar, the result is strangely different.
This is what the progress bar's result looks like using Option 1
This is what the progress bar's result looks like using Option 2
Option one is the result I desire but I just couldn't find an explanation for the behavior of using Option 2. Can anyone help me explain this behavior?
...ANSWER
Answered 2020-Aug-22 at 17:45Looks like an existing bug with tqdm
. https://github.com/tqdm/tqdm/issues/766
Option 1:
- Provides tqdm the total size
- On each iteration, update progress. Expect the progress bar to keep moving.
- Works fine.
Option 2:
- Provides tqdm the total size along with a generator function that tracks the progress.
- On each iteration, it should automatically get the update from generator and push the progress bar.
- However, you also call
progress.update
manually, which should not be the case. - Instead let the generator do the job.
- But this doesn't work either, and the issue is already reported.
Suggestion on Option 1:
To avoid closing streams manually, you can enclose them inside with
statement. Same applies to tqdm as well.
QUESTION
BACKGROUND: Have the following code. Lines 5 & 6 are the most important here:
@echo off
setlocal EnableExtensions DisableDelayedExpansion
pushd "%~dp0" || exit /B
move /Y "Folder2.jpg" "Folder.jpg"
This line 5 for %%I in (.) do set "FOLDER=%%~nxI"
This line 6 "%ProgramFiles(x86)%\gallery-dl\gallery-dl.exe" -d "U:\11Web\gallery-dl" --download-archive "%~dp0zzzGDB.sqlite3" "https://www.pixiv.net/en/users/%FOLDER%/illustrations"
if not errorlevel 1 if exist "zzzGDB.sqlite3" del "Folder.jpg"
popd
endlocal
In Windows Explorer I create a folder (for example) named "18604150". Any folders I create will have a folder name of varying lengths. The code above is in a .bat file within that folder. Upon executing the code, line 5 assigns folder name "18604150" to the variable and line 6 inserts/calls it as part of the hyperlink:
https://www.pixiv.net/en/users/%FOLDER%/illustrations
equates to
https://www.pixiv.net/en/users/18604150/illustrations
All is well.
PROBLEM: I want to be able to ALWAYS name folders as with the aforementioned numerical string at the beginning but IN SOME CASES also manually append artist name and/or other details to the folder name. Problem is I need to do this without "breaking" the variable and making it unusable for the hyperlink. Folder names could take on many shapes but will always begin with an unbroken first string of numbers. Examples:
18604150 -59 Bob Marley-
4839 Dan the Man
19374759394727 Scooby Snack 43443
I need to pare the variable down to only the digits left of any first SPACE, when present.
18604150
4839
19374759394727
I'm guessing whatever the solution will likely have to be in Line 5, but I do not know what this would look like.
for %%I in (.) do set "FOLDER=%%~nxI"
ANSWER
Answered 2020-Jul-28 at 03:31A little trial and error got my answer. Thanks goes to https://www.dostips.com/DtTipsStringManipulation.php
@echo off
setlocal EnableExtensions DisableDelayedExpansion
pushd "%~dp0" || exit /B
move /Y "Folder2.jpg" "Folder.jpg"
for %%I in (.) do set "FOLDER=%%~nxI"
for /f "tokens=1 delims= " %%a in ("%FOLDER%") do set FOLDER=%%a
"%ProgramFiles(x86)%\gallery-dl\gallery-dl.exe" -d "U:\11Web\gallery-dl" --download-archive "%~dp0zzzGDB.sqlite3" "https://www.pixiv.net/en/users/%FOLDER%/illustrations"
if not errorlevel 1 if exist "zzzGDB.sqlite3" del "Folder.jpg"
popd
endlocal
pause
QUESTION
Having a hard time entering text into the credentials page on: Pixiv
...ANSWER
Answered 2017-Jul-25 at 18:49There are actually two elements on this page that use that XPath. The webdriver will choose the first element that meets the requirements set by the developer. Unfortunately the element you want is the second element in the DOM. However updating your XPath to be more specific will help:
QUESTION
The problem begins with this link
https://i1.pixiv.net/img-zip-ugoira/img/2017/04/05/00/24/41/62259492_ugoira600x600.zip
the file downloaded with the downloader is complete.
and I try to use python to download the file
...ANSWER
Answered 2017-Apr-07 at 14:47The differences are:
- You're using different SSL information: You're browser has a built-in set of certificate authorities. Python uses a set which comes with the OS. They differ & if the site you're accessing uses one know to your browser but not known to python, the python will throw an exception.
- You're accessing using different User-Agents. Your browser is telling the server it's Chrome or IE or whatever. Python is telling the server it's python. For whatever reason, the server may decide it doesn't like that and return Forbidden.
- The server may be working harder than you think: while it appears the request is for a simple file, you're really requesting a resource. It may be (though unlikely in this case) that the resource you're requesting results in multiple interactions between the server and your browser -- cookies, javascript, etc -- which are executed successfully in your browser, returned to the server & it then delivers the file. Your python request is not doing any of that.
- Your browser (may) have existing state which your python does not. You say you can access the file using your browser, but it could be that works only because you've accessed other resources on the site, or logged in, or whatever. Your browser is communicating that information (perhaps a session_id via cookie?) with the server recognizes. Your python code states with no previous state, so the server forbids that.
Which is it in this case? You'll need to investigate. Can you get wget or curl to work? Debug your browser's access: what headers are being sent, what are you receiving in reply?
QUESTION
I am learning python crawler these days, and I write a simple crawler to get the picture on the Pixiv by Pixiv ID.
It works quite well, but here comes a big problem: When it is running, it takes up nearly 1.2G memory on my computer.
However, sometimes it just takes up just 10M memory, I really don't know which code causes such big usage of memory.
I have uploaded the script to my VPS(Only 768M memory Vulter server) and tried to run. As a result, I get a MerroyError.
So I wonder how to optimize the memory usage(even if taking more time to run).
Here is my code:
(I have rewrote all the code to make it pass pep8
, if still unclear, please tell me which code makes you confused.)
ANSWER
Answered 2017-Mar-09 at 17:23OMG!
Finally, I know what goes wrong.
I use mem_top()
to see what takes up the memory.
Guess what?
It is for i in range(0, 38849402):
In the memory, there is a list [0, 1, 2, 3 ... 38849401], which takes up my memory.
I change it to :
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Pixiv
You can use Pixiv like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page