mdl-scraper
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "mdl-scraper", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A npm package for scraping data from mydramalist", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
], | ||
"homepage": "https://github.com/sujalgoel/mdl-scraper", | ||
"homepage": "https://github.com/sujalgoel/mdl-scraper#readme", | ||
"license": "GPL-3.0", | ||
@@ -18,0 +18,0 @@ "bugs": { |
@@ -150,2 +150,32 @@ <h1 align="center">MDL Scraper</h1> | ||
<details> | ||
<summary>FetchPerson example</summary> | ||
```js | ||
const { mdl } = require("mdl-scraper"); | ||
mdl.FetchPerson("5647-bong-joon-ho").then((data) => { | ||
console.log(data); | ||
}); | ||
``` | ||
### Example Response | ||
```json | ||
{ | ||
"name":"Bong Joon Ho", | ||
"about":"`Bong Joon Ho Name: Bong Joon Ho Native name: 봉준호 Nationality: South Korean Gender: Male Born: September 14, 1969 Age: 51 Bong Joon-ho is a South Korean film director and screenwriter. Bong in general is known as being a director who takes a great interest in film genres, while simultaneously trying to move beyond genre's usual boundaries. Also known for the pure craft and finished quality of his works, Korean film industry insiders have nicknamed him \"Bong Tae-il,\" which, pronounced in Korean, sounds similar to the word \"detail\". Though he displays a fascination for strong subject matter, at the same time, his films are filled with (often black) humor and sudden mood shifts, making for an emotional roller coaster ride. The fact that he is able to combine all these contrasting elements into such a smooth whole is Bong's particular strength as a filmmaker. In 2019, director, Bong Joon-ho won the Cannes Palm d'Or (Grand Prize) for his movie Parasite. This is the first Korean film to ever win the award.`", | ||
"profile":"https://i.mydramalist.com/dWLK5_5c.jpg", | ||
"first_name":"Joon Ho", | ||
"family_name":"Bong", | ||
"native_name":"봉준호", | ||
"nationality":"South Korean", | ||
"gender":"Male", | ||
"born":"September 14, 1969", | ||
"age":"51" | ||
} | ||
``` | ||
</details> | ||
## Contributing 🤝 | ||
@@ -163,3 +193,3 @@ | ||
## Support ❓ | ||
<img src="https://invidget.switchblade.xyz/2SUybzb"> | ||
## Support ❓ | ||
<a href="https://discord.gg/2SUybzb"><img src="https://invidget.switchblade.xyz/2SUybzb"></a> |
@@ -90,2 +90,21 @@ const BASE_URL = 'https://mydramalist.com'; | ||
}, | ||
async FetchPerson(query) { | ||
try { | ||
const $ = await fetchhtml(`${BASE_URL}/people/${query}`); | ||
const profile = {}; | ||
const container = $('div[class="app-body"]'); | ||
profile.name = container.find('h1[class="film-title m-b-0"]').text().trim(); | ||
profile.about = container.find('div[class="col-sm-8 col-lg-12 col-md-12"]').text().trim().replace(/\n/g, ''); | ||
profile.profile = fetchPoster(container); | ||
const details = {}; | ||
container.find('ul[class="list m-b-0"]').find('li').each((i, e) => { | ||
const title = $(e).find('b').text().trim(); | ||
details[title.replace(':', '').replace(/\s/g, '_').toLowerCase()] = $(e).text().replace(title + ' ', '').trim(); | ||
}); | ||
const data = Object.assign({}, profile, details); | ||
return data; | ||
} catch (e) { | ||
throw new Error(e); | ||
} | ||
}, | ||
}; |
const { mdl } = require('../index'); | ||
// mdl.SearchQuery('aloners') | ||
// .then((data) => { | ||
// console.log('SearchQuery Example:'); | ||
// console.log(data); | ||
// }); | ||
mdl.SearchQuery('aloners') | ||
.then((data) => { | ||
console.log('SearchQuery Example:'); | ||
console.log(data); | ||
}); | ||
@@ -13,2 +13,8 @@ mdl.FetchQuery('696359-people-living-alone') | ||
console.log(data); | ||
}); | ||
mdl.FetchPerson('5647-bong-joon-ho') | ||
.then((data) => { | ||
console.log('FetchPerson Example:'); | ||
console.log(data); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52826
242
193