Giter VIP home page Giter VIP logo

horriblesubs-api's People

Contributors

amilajack avatar chrisalderson avatar hanimayahi avatar joncppl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

horriblesubs-api's Issues

TypeError: Cannot read property 'link' of undefined

I'm getting this error while using the README code.

const HorribleSubsApi = require("horriblesubs-api");

// Create a new instance of the module.
const horriblesubs = new HorribleSubsApi({ baseUrl: "https://horriblesubs.info/" });

app.use(express.static("public"));

// https://expressjs.com/en/starter/basic-routing.html
app.get("/", (request, res) => {
  horriblesubs
    .getAllAnime()
    .then(res => {
      const [data] = res;
      console.log(data);

      // Get data including episodes from horriblesubs.
      res.send(horriblesubs.getAnimeData(data));
    })
    .then(res => console.log(res))
    .catch(err => console.error(err));
});

CORS error No 'Access-Control-Allow-Origin' - Angular 4

Hi,

Love the work you're doing, it seems I'm getting a CORS issue, i just wrapped my service around yours, you can see below:

Error:

Fetch API cannot load http://horriblesubs.info/shows/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

horrible-subs.service.ts:

import { Injectable } from '@angular/core';
import * as HorribleSubsAPI from 'horriblesubs-api';

@Injectable()
export class HorribleSubsService {
private horribleSubs: HorribleSubsAPI;
constructor() {
this.horribleSubs = new HorribleSubsAPI();
}

public getAll(): any {
    return this.horribleSubs.getAllAnime().then(res => {
        const [ data ] = res;
        console.log(data);
        // Get data including episodes from horriblesubs.
        return this.horribleSubs.getAnimeData(data);
      }).then(res => console.log(res))
        .catch(err => console.error(err));
}

}

Home component:
import { Component, OnInit } from '@angular/core';
import { HorribleSubsService } from 'app/horrible-subs.service';

@component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

public content: {};
constructor(private horribleSubs: HorribleSubsService) { }

ngOnInit() {
    this.content = this.horribleSubs.getAll();
}

}

Any good way to resolve this?

Thanks!

HTTPError: Response code 404 (Not Found) for getAnimeData()

Hi, I really appreciate the work you do and it has helped me out in some of my personal projects! Hoowever, just last night getAnimeData() stopped working.

My Code:

this.horribleSubs.getAllAnime().then((HsRes) => {
               return HsRes;
            }).then((data) => {
                return this.horribleSubs.getAnimeData(data);
            }).then((data) => {
                res.send(data);
            })
            .catch(err => console.error(err));

The Error thrown:

{ HTTPError: Response code 404 (Not Found)
    at StdError (C:\Users\LOLCAT\Documents\animstream\animstream-backend\node_modules\got\index.js:410:3)
    at C:\Users\LOLCAT\Documents\animstream\animstream-backend\node_modules\got\index.js:454:3
    at stream.catch.then.e (C:\Users\LOLCAT\Documents\animstream\animstream-backend\node_modules\got\index.js:182:13)
    at process._tickCallback (internal/process/next_tick.js:109:7)
  name: 'HTTPError',
  host: 'horriblesubs.info',
  hostname: 'horriblesubs.info',
  method: 'GET',
  path: '/undefined?',
  protocol: 'https:',
  url: 'https://horriblesubs.info/undefined',
  statusCode: 404,
  statusMessage: 'Not Found',
  headers:
   { date: 'Sat, 30 Sep 2017 11:43:40 GMT',
     'content-type': 'text/html; charset=UTF-8',
     'transfer-encoding': 'chunked',
     connection: 'close',
     'set-cookie': [ '__cfduid=d65ea6297084293854bcaf026ece578e71506771820; expires=Sun, 30-Sep-18 11:43:40 GMT; path=/; domain=.horriblesubs.info; HttpOnly' ]
,
     vary: 'Cookie',
     expires: 'Wed, 11 Jan 1984 05:00:00 GMT',
     'cache-control': 'no-cache, must-revalidate, max-age=0',
     link: '<http://horriblesubs.info/wp-json/>; rel="https://api.w.org/"',
     server: 'cloudflare-nginx',
     'cf-ray': '3a66ed037dfe6b91-LHR',
     'content-encoding': 'gzip' } }

I would assume changed their DOM in some way which could be the reason throwing this error?

Error: Uncaught (in promise) ReferenceError: setImmediate is not defined

Uncaught (in promise) ReferenceError: setImmediate is not defined
    at requestAsEventEmitter (test.js:8932)
    at PCancelable (test.js:8944)
    at PCancelable._promise.Promise (test.js:9472)
    at new Promise (<anonymous>)
    at new PCancelable (test.js:9469)
    at asPromise (test.js:8943)
    at got (test.js:9195)
    at Function.got.(anonymous function) [as get] (http://localhost:3002/assets/js/test.js:9213:31)
    at HorribleSubsApi._get (test.js:8256)
    at HorribleSubsApi.getAllAnime (test.js:8266)

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.