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

Requesting extractor for fetlife.com #909

Open
Ogwalla opened this issue Jul 26, 2020 · 3 comments
Open

Requesting extractor for fetlife.com #909

Ogwalla opened this issue Jul 26, 2020 · 3 comments

Comments

@Ogwalla
Copy link

Ogwalla commented Jul 26, 2020

No description provided.

@Ogwalla Ogwalla changed the title Requesting extractor for fetlife.com label:nsfw label:site-support Requesting extractor for fetlife.com Jul 26, 2020
@Ogwalla Ogwalla changed the title Requesting extractor for fetlife.com Requesting extractor for fetlife.com name(nsfw) Jul 26, 2020
@Ogwalla Ogwalla changed the title Requesting extractor for fetlife.com name(nsfw) Requesting extractor for fetlife.com Jul 26, 2020
@dic-l-art
Copy link

reposting tags from #1244

Examples:

NSFW

"{this link may or may not be NSFW}" == SFW

@yusufbromack
Copy link

yusufbromack commented Sep 19, 2024

The biggest issue with fetlife is the service-worker.js that intercepts client side fetch requests and rewrites the headers. I'm still working on it but it's a pita for sure.

In the meantime, here's a quick IIFE I wrote in javascript to grab individual photos. tldr; it creates a new dom img object that has the u2000 tokenized url as the src, allowing it to be right clicked and downloaded. **updated to reuse the imgcontainer if ran multiple times, sets it to be on top of the other containers (was getting buried below comments)

(() => {
  function getimage() {
    const images = document.querySelectorAll('img');
    let arr = [];
    for (let i = 0; i < images.length; i++) {
      if (images[i].currentSrc.includes('u1000')) {
        arr.push(images[i]);
      }
    }
    return arr;
  }

  function setid(arr) {
    let image;
    for (let i = 0; i < arr.length; i++) {
      let imgElement = arr[i];
      imgElement.id = `myImage`;
      image = imgElement;
    }
    return image;
  }

  function get2xsrc(image) {
    const srcset = image.getAttribute('srcset');
    const regex = /1x, (.*?) 2x/;
    const match = srcset.match(regex);
    let chosenSrc = '';
    if (match) {
      const url = match[1];
      chosenSrc = url;
    }
    return chosenSrc;
  }

  function makeimgcontainer(chosenSrc) {
    const fn = window.location.href.split('/').pop();
    let imgcontainer = document.getElementById('img-container');

    if (!imgcontainer) {
      imgcontainer = document.createElement('div');
      imgcontainer.id = 'img-container';
      imgcontainer.style.position = 'absolute';
      imgcontainer.style.zIndex = '9999';
      imgcontainer.style.display = 'grid';
      imgcontainer.style.gridTemplateColumns = 'repeat(4, 1fr)';
      imgcontainer.style.gap = '2px';
      imgcontainer.style.border = '1px solid #DDDDDD';
      imgcontainer.style.overflow = 'hidden';
      imgcontainer.style.display = 'inline-block';
      imgcontainer.style.width = '25%';
      document.body.appendChild(imgcontainer);
    }

    const img = document.createElement('img');
    img.src = chosenSrc;
    img.id = 'img-img'
    img.style.width = '100%';
    img.style.height = 'auto';

    imgcontainer.appendChild(img);
  }

  const images = getimage();
  if (images.length > 0) {
    const image = setid(images);
    const chosenSrc = get2xsrc(image);

    if (chosenSrc) {
      makeimgcontainer(chosenSrc);
    }
  }
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants