Giter Club home page Giter Club logo

Comments (8)

accesstechnology-mike avatar accesstechnology-mike commented on July 30, 2024 1

Package: 0.2.6

I assume you mean 2.0.6. Update the package to 2.0.9 and see if the problem persists, there have been several updates that could be related

Not a typo! Didn't realise is was so out of date. Will update app to latest version and report back.

from scrape-youtube.

accesstechnology-mike avatar accesstechnology-mike commented on July 30, 2024 1

Code here:

const express = require("express");
const { default: youtube } = require("scrape-youtube");

const cache = require("../helpers/cache");

const Router = express.Router();

Router.get("/search", async (req, res) => {
  try {
    let { q, cached } = req.query;
    const allowCached = cached !== "false";
    if (!q) return res.send({ error: "Invalid query!" });
    q = q.trim();
    if (allowCached) {
      const cachedResults = await cache.getResults(q);
      if (cachedResults && cachedResults.length !== 0) {
        return res.send({ results: cachedResults, cached: true });
      }
    }
    let freshResults = await youtube.search(
      q,
      { safeSearch: true },
      { safeSearch: true, headers: { Cookie: "PREF=f2=8000000" } }
    );
    freshResults = freshResults.videos.map((video) => ({
      id: video.id,
      title: video.title,
    }));
    res.send({ results: freshResults, length: freshResults.length });
    if (freshResults.length > 0) await cache.saveResults(q, freshResults);
  } catch (error) {
    console.error(error);
    res.send({ error: "Backend error." });
  }
});

module.exports = Router;

from scrape-youtube.

DrKain avatar DrKain commented on July 30, 2024

Package: 0.2.6

I assume you mean 2.0.6. Update the package to 2.0.9 and see if the problem persists, there have been several updates that could be related

from scrape-youtube.

accesstechnology-mike avatar accesstechnology-mike commented on July 30, 2024

updated to latest v2.0.9. Problem still persists unfortunately.

image

For reference, most other searches are working fine:

image

'duggee' never works, 'lego' is intermittent

from scrape-youtube.

DrKain avatar DrKain commented on July 30, 2024

Alright thanks for reporting. I ran a few tests on a server I have in London and wasn't able to reproduce the issue you're having.
I'll need to dig around more during the weekend. If you could provide a sample of the code (showing how you're using the package, filtering the results ect) that would be helpful.

from scrape-youtube.

accesstechnology-mike avatar accesstechnology-mike commented on July 30, 2024

from scrape-youtube.

accesstechnology-mike avatar accesstechnology-mike commented on July 30, 2024

Hi, this is happening again on 2.0.9:

image

from scrape-youtube.

accesstechnology-mike avatar accesstechnology-mike commented on July 30, 2024

image
cats / lego and both intermittent too

from scrape-youtube.

Related Issues (20)

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.