Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name vsco.co downloader
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match https://vsco.co/*/gallery
- // @icon https://www.google.com/s2/favicons?sz=64&domain=vsco.co
- // @grant GM_download
- // ==/UserScript==
- (function() {
- 'use strict';
- window.addEventListener('load', () => {
- addButton('download all images', selectReadFn)
- })
- function addButton(text, onclick, cssObj) {
- cssObj = cssObj || {position: 'absolute', bottom: '7%', left:'4%', 'z-index': 3};
- var button = document.createElement('button'), btnStyle = button.style;
- document.body.appendChild(button);
- button.innerHTML = text;
- button.onclick = onclick;
- Object.keys(cssObj).forEach(key => btnStyle[key] = cssObj[key]);
- return button;
- }
- function selectReadFn() {
- var subname = prompt("Enter sub name:");
- document.querySelectorAll('section > div > div > figure > a > div > div > img').forEach(el => {
- var src = el.getAttribute("src");
- src = src.replace('?w=260', '');
- src = src.slice(2);
- var name = src.split('/')[4] +'.' + src.split('/')[5];//.split('.')[0];
- if (src != null && name != null && subname != null)
- {
- console.log('Download ' + src);
- var arg = {
- url: 'https://' + src,
- name: subname + "_" + name
- };
- GM_download(arg);
- }
- else
- {
- console.log('Cannot download ' + src);
- }
- });
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment