ThaiSEOBoard.com

ความรู้ทั่วไป => General (ถามคุยวิชาการ IM) => ข้อความที่เริ่มโดย: santayeen ที่ 10 ตุลาคม 2018, 16:18:33



หัวข้อ: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: santayeen ที่ 10 ตุลาคม 2018, 16:18:33
ตัวอย่างเช่น https://www.website.com/room/***/photo.html

อยากจะเก็บลิ้งค์ โดยให้หาตรง *** ในเว็บหลาย ๆ ลิ้งค์อ่ะครับ

ตัวอย่างอีกเผื่อไม่เข้าใจ
https://www.website.com/room/001/photo.html
https://www.website.com/room/002/photo.html
https://www.website.com/room/003/photo.html

ประมาณนี้อ่ะครับ พอจะมีเครื่องมือไหนทำได้บ้าง ขอบคุณครับ


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: น้องพี่ต้าร์ ที่ 10 ตุลาคม 2018, 16:24:27
imacro
php


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: BOS ที่ 10 ตุลาคม 2018, 19:40:01
ตัวอย่างลิ้งก์มีรูปแบบอื่นอีกไหมครับ หรือมีรูปแบบแค่ประมาณนี้
โค๊ด:
h33ps://www.website.com/room/001/photo.html
h33ps://www.website.com/room/002/photo.html
h33ps://www.website.com/room/003/photo.html

เพราะถ้าแค่ประมาณนี้ก็ง่ายเลยครับ
ใช้ javascript regex

var links = [
     'h33ps://www.website.com/room/001/photo.html',
     'h33ps://www.website.com/room/002/photo.html',
     'h33ps://www.website.com/room/003/photo.html'
];
var res = [];
links.forEach( function(v) {
     res.push( v.match(/\/(\d+)\//)[1] );
});
console.log( res );



หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: dekdoo ที่ 10 ตุลาคม 2018, 20:54:31
 :wanwan003:


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: CherryX ที่ 10 ตุลาคม 2018, 22:46:23
ถ้ามันเรียงกันใช้ imacros ก็ได้คะ  :wanwan003:


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: josepcuteboy ที่ 11 ตุลาคม 2018, 13:14:40
มีนะ


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: maneemeena ที่ 11 ตุลาคม 2018, 13:19:42
คีย์เวิดคือ regex ครับ


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: ฺBoardThai ที่ 11 ตุลาคม 2018, 13:21:12
คนเก่งๆ ในนี้เยอะมาก กราบบบบบ  :wanwan017:


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: santayeen ที่ 11 ตุลาคม 2018, 14:37:37
ตัวอย่างลิ้งก์มีรูปแบบอื่นอีกไหมครับ หรือมีรูปแบบแค่ประมาณนี้
โค๊ด:
h33ps://www.website.com/room/001/photo.html
h33ps://www.website.com/room/002/photo.html
h33ps://www.website.com/room/003/photo.html

เพราะถ้าแค่ประมาณนี้ก็ง่ายเลยครับ
ใช้ javascript regex

var links = [
     'h33ps://www.website.com/room/001/photo.html',
     'h33ps://www.website.com/room/002/photo.html',
     'h33ps://www.website.com/room/003/photo.html'
];
var res = [];
links.forEach( function(v) {
     res.push( v.match(/\/(\d+)\//)[1] );
});
console.log( res );




ถ้าหาเป็นชื่ออ่ะครับ เช่น

h33ps://www.website.com/room/dog/photo.html
h33ps://www.website.com/room/cat/photo.html
h33ps://www.website.com/room/fish/photo.html

ตรง dog cat fish
ปล. ลองใช้ imacro ไม่ได้ครับ ไม่มีหน้าเว็บให้เก็บ


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: BOS ที่ 11 ตุลาคม 2018, 16:49:10
ถ้าหาเป็นชื่ออ่ะครับ เช่น

h33ps://www.website.com/room/dog/photo.html
h33ps://www.website.com/room/cat/photo.html
h33ps://www.website.com/room/fish/photo.html

ตรง dog cat fish
ปล. ลองใช้ imacro ไม่ได้ครับ ไม่มีหน้าเว็บให้เก็บ

งั้นก็แบบนี้ครับ

var links = [
     'h33ps://www.website.com/room/001/photo.html',
     'h33ps://www.website.com/room/002/photo.html',
     'h33ps://www.website.com/room/003/photo.html',
     'h33ps://www.website.com/room/dog/photo.html',
     'h33ps://www.website.com/room/cat/photo.html',
     'h33ps://www.website.com/room/fish/photo.html'
];
var res = [];
links.forEach( function(v) {
     res.push( v.match( /\.com\/room\/(.*)\// )[1] );
});
console.log( res );
// ["001", "002", "003", "dog", "cat", "fish"]


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: 2DTH ที่ 11 ตุลาคม 2018, 18:39:11
ไม่รู้ว่าจะตรงที่ให้ช่วยรึเปล่า  :(
#PHP
โค๊ด:
http://phpfiddle.org/main/code/6md5-s0r0


หัวข้อ: Re: มีวิธีหา url ระหว่างลิ้งค์มั้ยครับ
เริ่มหัวข้อโดย: bigbikeinfo ที่ 23 ตุลาคม 2018, 22:48:17
ตามด้วยครับต้องการเหมียนกัน