mhsjlw / imdb Goto Github PK
View Code? Open in Web Editor NEWAn IMDb interface for Node
License: MIT License
An IMDb interface for Node
License: MIT License
Hi,
I really have enjoyed playing around this nodejs module, very good work i like cheeriojs a lot.
So, i have just added quotes.js if you can tell me if you have an idea on how is it possible to keep working with regexp instead of what i've added in the cases of imdb.js
Currently i found that gives me title in local language
<h1 itemprop="name" class="">Тихоокеанський рубiж: Повстання <span id="titleYear">(<a href="/year/2018/?ref_=tt_ov_inf"
>2018</a>)</span> </h1>
<div class="originalTitle">Pacific Rim: Uprising<span class="description"> (original title)</span></div>
May be there some url param which should give in english or we can add if condition
The current API and internal API is completely awful
When I try and run the readme example
var imdb = require('imdb');
imdb('tt3659388', function(err, data) {
if(err)
throw err;
console.log(data);
});
I get the following error
D:\Documents\GitHub\imdb\node_modules\imdb\lib\imdb.js:14
var year = body.match(/<span class="nobr">\(<a href="\/year\/\d+\/\?ref_=tt_ov_inf">(\d+)<\/a>\)<\/span>/i)[1];
^
TypeError: Cannot read property '1' of null
at Request._callback (D:\Documents\GitHub\imdb\node_modules\imdb\lib\imdb.js:14:120)
at Request.self.callback (D:\Documents\GitHub\imdb\node_modules\imdb\node_modules\request\request.js:199:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request.<anonymous> (D:\Documents\GitHub\imdb\node_modules\imdb\node_modules\request\request.js:1036:10)
at emitOne (events.js:82:20)
at Request.emit (events.js:169:7)
at IncomingMessage.<anonymous> (D:\Documents\GitHub\imdb\node_modules\imdb\node_modules\request\request.js:963:12)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
Program node app.js -dev exited with code 1
Out with the callbacks, in with the promises. Requires a massive API overhaul as well, possibly to make it less stringly-typed
Hey, I just tried this...
//url is like this: http://www.imdb.com/title/tt0468569/
const url = e.target.href
const imdbRegex = new RegExp("tt\\d{7}", "g")
const imdbId = url.match( imdbRegex )
//console.log(imdbId[0]) I get the correct ID
imdb(imdbId[0], (err, data) => {
if (err)
console.log(err.stack);
if (data)
console.log(data);
});
Response:
Failed to load http://www.imdb.com/title/tt0468569/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mysite.dev' 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.
Any idea what how can I fix this?
I have tried adding this on .htaccess but not working
Header set Access-Control-Allow-Origin "*"
Is this a feature that people would be interested in?
Under going a massive change, going to mark it as 2.0, includes:
Track the progress at the typescript
branch. Help is appreciated
Hello,
I used this package a few months ago with success; I recently came back to it, and I don't seem to be receiving any results anymore from it. I would always get the following:
{
title: 'N/A',
year: 'N/A',
contentRating: 'N/A',
runtime: 'N/A',
description: '',
rating: 'N/A',
poster: 'N/A',
genre: [ 'N/A' ],
director: 'N/A',
metascore: 'N/A',
writer: 'N/A'
}
Not sure what's not working; but the module seems to be looking for a title-overview-widget
node that doesn't exist on the returned page. Might it be that the imdb page format changed?
Cheers
Joel
Is there any way to integrate this with ebouther/imdb-id?
I'm new at js so unfortunately I can't do this myself
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.