How to download mobile version of a website using Scrapy - mobile

I am trying to understand how to download the mobile version of a website using Scrapy (Google for example).
I don't know how to emulate those requests as I don't have a debugger in my phone. How could I do it using Scrapy or how could I debug mobile requests using my desktop

You can totally use your desktop to emulate mobile behavior. Use Chrome's Developer Tools and click the Toogle device toolbar button:
That way you can check which requests are being used for mobile version.
Now normally, this is specified by the User-Agent header, so just a mobile one, that could be for example changing the USER_AGENT in settings:
USER_AGENT = 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1'

Related

How to get mac address or uuid from mobile device PDA based on JavaScript?

I am going to make a mobile web page that calls URL in a web method from a Chrome browser on a PDA PM85. The weird thing is to get the mac address or uuid of the mobile device from javascript, but I don't know how.

How does google (search) serve its mobile site?

The site itself isn't responsive using CSS as far as i can tell. Is it a dedicated mobile site that is loaded based on HTTP Content Type header?? The URL is shared between both desktop and mobile. How does this work??
Probably using the User-Agent HTTP header. This shows the platform as well as the browser type you are using. That way you can enable desktop mode even on mobile devices. If you change to desktop mode on mobile the phone sends a different User-Agent string (One that is like a desktop user agent).
The server then serves a different page than normal
Edit:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
Thats my user String. You can see Windows NT 10.0, WOW64 there. That translates into Windows 10 64Bit
Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
Thats the Android webkit user agent string. Android is basicly Linux. These user agent strings often have android version, language and device model in them. In the Above example it woult be an LG-L160L running Android 4.0.3 with South Korean language.

Mobile detection in a website

I want a scenario where in I have a website and when I connect my mobile device to my pc or laptop, the website must be able to detect the phone and not the phone browser. As in it should detect if my phone is an iphone or any other mobile device. How can I achieve this?
Basically if I have a downloadable application and a list of compatible devices and when a device is connected, a compatibility check needs to be done and the software has to be downloaded directly! Is this possible?
you must build an APP and not a WebAPP or website.
the browser cant send relevant information such MacAddress or IMEI then you cannot do it with a simple website.
In javascript you can detect navigation browser and it has some extra information about the kind of device (like Android, Motorola, etc). For example this.

Auto Redirect to Mobile Site

I want when a mobile device, (such as Android Phone; Tablet, iPad, iPhone, iPod, or any other mobile device) to redirect to the mobile site instead of the actual site, but I'm not sure how to do this.
In my case, the URL for my main site is super-short.freeoda.com and the mobile url is http://mobile.dudamobile.com/site/super-short_freeoda_2/
If you want to keep it quick and dirty, you might want to check out PHP Mobile Detect for simple mobile redirects. It does some basic categorization into mobile, tablet, and the main platforms (iOS, Android, BB, etc.) based on a well-crafted regex on User-Agent strings.
Taking it further, you can try device databases like WURFL or Device Atlas, but they're more heavy-weight.
To be conscientious, make sure to include a clear link back to the "full" or "desktop" site to account for possible mis-detections.

Is there a way to spoof a desktop browser response to a css media query?

Maybe a browser plugin? Just looking for a dirty, quick way to test some mobile web development.
Here's 3 tools I found pretty helpful for testing media queries for mobile devices within my desktop browser:
Adobe Shadow: You'll have to download the app on your mobile device, and then link the device to Chrome and once you've done so you can inspect your webpages on chrome as they would appear on your mobile device.
Remote Debugging with Chrome for Android: Similar to Adobe Shadow, but I found this to be a lot more reliable when dealing with network requests on mobile devices - you will need a android device with Ice Cream Sandwich however.
Changing User Agent on Safari to debug different browsers straight from your desktop Safari: If you have Safari, it allows you to change the useragent string from the developer tools. Pretty useful if you want to spoof browsers. - Didn't really find this useful for media queries though.
Go into Safari settings, there is one that reads "Request Desktop Website." Check it, then browse to facebook.com Now you can message within browser. No app needed.

Resources