Coder Social home page Coder Social logo

zhihu-slideshow's Introduction

zhihu-slideshow

A Supersized demo 演示地址

图片手工抓取的主要步骤

图片来源 https://www.zhihu.com/question/36759180

  • 获取所有图片链接
var str = ''; $('img[class*="image"]').each(function(){ str += '$(this).attr('data-original') + '\n' + $(this).attr('src') + '\n'; }); console.log(str);
  • 下载所有图片
mkdir images && cd images
vi files.txt
# 将前一步得到的图片链接粘帖进去
...

wget --no-check-certificate -i files.txt
  • 生成slideshow所需的格式数据,提供给slideshow组件
var str = ''; $('img[class*="image"]').each(function(){ str += '{image: \'' + $(this).attr('data-original') + '\', thumb: \'' +
$(this).attr('src') + '\'},\n'; }); console.log(str);
  • 在编辑器里写个正则替换,用相对地址替换原始的图片链接 搜索 https://\w+.zhimg.com/, 替换为images/

本来是想找一个以slideshow的方式,浏览指定网页上图片的网页工具。 一时没找到,就先起了个草稿,在这个基础上,考虑工具如何实现

实现思路:

  • 以限定网站为前提
  • 后端收到用户提交的网页地址,抓出图片地址
  • 异步下载图片到本地
  • 用本地图片地址,生成slideshow所需的json格式
  • 处理好后邮件通知用户,附上slideshow的网址
  • 仅能自己用

zhihu-slideshow's People

Contributors

yicone avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.