Comments (14)
This is awesome! Thanks for making this repo. I think i'm going to make a new module called openGraphScraperLite
that will use ky
for it's requests. Hopefully that will fix this problem. (This might take me a few days/weeks)
ky
docs: https://github.com/sindresorhus/ky
from opengraphscraper.
Okay. I made a new lib here -> https://github.com/jshemas/openGraphScraperLite and forked the example vue project here -> https://github.com/jshemas/vue-opengraph
I keep getting a bunch of CORS errors, but I think I'm getting really close to getting this to work.
from opengraphscraper.
Hi @jshemas Yes, here is a code repo with this problem: https://github.com/runemy/vue-opengraph
from opengraphscraper.
Hello,
Using your code from above I was able to get this result (without using yarn add http2
, using node v12.16.3):
results: {
charset: 'iso-8859-1',
requestUrl: 'https://www.test.com',
success: true
}
Are you sure this error is coming from ogs? Can you post the full stack trace? What version of node are you on? What is your OS?
Is this a React app? I wonder if you are having the same issue as grpc/grpc-node#610 or googleapis/nodejs-dialogflow#314
from opengraphscraper.
The same issue!
It works perfectly on my Nodejs backend.
But on my React client (init by using create-react-app) it say
Module not found: Can't resolve 'http2'
After installed http2 (with warning "WARN deprecated [email protected]: Use the built-in module in node 9.0.0 or newer, instead"),
the client says error
TypeError: Cannot read property 'split' of undefined
(anonymous function) C:/..../node_modules/@szmarczak/http-timer/dist/source/index.js:4
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | const defer_to_connect_1 = require("defer-to-connect");
4 | const nodejsMajorVersion = Number(process.versions.node.split('.')[0]); <----
5 | const timer = (request) => {
6 | const timings = {
7 | start: Date.now(),
Sorry my bad English.
Hope this issue would be resolved soon!
Thanks 🥰
from opengraphscraper.
@trwong @NoCtrlZ1110 Can one of you make a code repo with this problem? I'm not familiar with react and having a code repo with this problem would help me solve it.
from opengraphscraper.
Trying to use this in a Vue App i get this error:
` ERROR Failed to compile with 4 errors 7:18:00 PM
These dependencies were not found:
- dns in ./node_modules/cacheable-lookup/source/index.js
- http2 in ./node_modules/http2-wrapper/source/index.js, ./node_modules/http2-wrapper/source/client-request.js and 1 other`
from opengraphscraper.
@runemy Can you make a code repo with this problem? I'm not familiar with vue and having a code repo with this problem would help me solve it.
from opengraphscraper.
Actually this might be the problem sindresorhus/got#1400
Got is meant for Node.js. While it can work in the browser with the right polyfills, you're on your own support-wise. Try asking on Stack Overflow instead.
openGraphScraper uses Got
for making HTTP requests. I'm not really sure how to fix this with having to rewrite a lot of stuff. I could make a fork of openGraphScraper without a request library.
from opengraphscraper.
hello, is there any solutions for this issue?
from opengraphscraper.
Still working on this issue. I got ky
to sorta work inside openGraphScraper
but there is still a few edge cases I'm working on.
from opengraphscraper.
Hi,
Sounds good with this progress :) Good work.
I do also get these CORS errors.
from opengraphscraper.
So, I'm starting to think this isn't really possible to do these types of requests in the browser. This article has a good explanation.
To understand how XMLHttpRequest would be dangerous if cross-origin requests were allowed, imagine if you visited a site at evil.com that used XMLHttpRequest to make requests to gmail.com. If you were logged into Gmail in your browser, evil.com would be able to read all of your email. This example shows why it is the site that receives the request that must indicate when cross-origin XMLHttpRequest is allowed. If the requesting site could bypass the browser's restriction, malicious websites could access any site you were logged into.
from opengraphscraper.
Closing this for now. I think the best fix for this problem is to use a backend server to make the requests and then pass in the html
into ogs.
from opengraphscraper.
Related Issues (20)
- Module not found: Can't resolve 'http2' HOT 1
- reuslt.twitterImage is improperly typed as string | undefined HOT 3
- open-graph-scraper > 4.11.1 jest and supertest segfault HOT 3
- Cannot find module './lib/openGraphScraper' or its corresponding type declarations HOT 3
- TS Error: Cannot find module './lib/openGraphScraper' HOT 3
- Something is not right with the types HOT 4
- Type error in index.ts HOT 1
- Missing got dependency HOT 2
- Types Errors HOT 6
- Can the library keyv be replaced with something else? HOT 3
- fetchOptions type HOT 1
- Regression: Fetching `https://facebook.com` yields no image HOT 5
- Lower Node 18 requirement HOT 1
- Problem with specifying the html option in TypeScript HOT 1
- Why the error with a generic 400/500 error message? HOT 2
- Twitter / X.com Open graph tags not working anymore HOT 4
- It is better to export SuccessResult and ErrorResult types HOT 2
- Fail to detect charset from certain ShiftJIS page HOT 10
- Add Support for Edge Functions HOT 2
- Support title & description fields HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opengraphscraper.