Getting the title name with CSS selectors in Scrapy

Using scrapy for web scraping, I encountered the following html structure:

<a class="pointy" title="Rating: 9 / 10">dont select this text</a>
<a class="pointy" title="Rating: 1 / 10">or this text</a>

Q: How can I extract the title name from the HTML without prior knowledge of its exact content? For instance, in this scenario, "Rating: 9/10" and "Rating: 1/10"?

Answer №1

.sharp::attr(title) is the precise css selector you need:

.sharp - element with the class of sharp
::attr(title) - retrieves the content of the attribute title

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Changing the content of a DOM element containing nested elements using JavaScript/jQuery

Need some help with a DOM element that looks like this: <span>text</span> <b>some more text</b> even more text here <div>maybe some text here</div> How can I replace text with candy to achieve this result: <span> ...

Utilizing ng-class with Boolean values in AngularJS

On my page, I have a pair of buttons that control the visibility of elements using ng-hide and ng-show. <a ng-click="showimage=true" ng-class="{ 'activated': showimage}" class="button">Images</a> <a ng-click="showimage=false" ng-c ...

Loading a link within a Vue.js component is a seamless process

Looking to incorporate an external URL into my Vue Application while keeping the Toolbar and Sidebar intact within a component. Any suggestions on how I can achieve this? Thanks in advance ...

Struggling to minimize space between icon buttons within a vertical layout (Bootstrap, HTML, and CSS)

My goal was to align the icon buttons with the dynamic table on their right side, but they are overflowing slightly instead. Desired look / Current appearance . Before sharing my code block, I experimented with various options: Adjusting padding, margin, ...

Generating interactive HTML content using a JSON file with AngularJS

Currently, I am working on a project where I have a nested JSON object within AngularJS. In order to create a menu from this JSON using the Bootstrap navbar, I need assistance with parsing the highly nested structure and generating dynamic HTML code to d ...

What is the method for aligning elements in a single row?

I have integrated bootstrap into my project. The width of the section is set to 350px. Below are the HTML elements I am working with: <form class="form-inline"> <div class="input-group input-group-sm col-xs-5" > <input type="t ...

Unable to display a custom image as a check mark on a checkbox

I tried to add some custom CSS to style the images on my checkmark boxes. The goal was to display an image with a checkmark when clicked, but unfortunately, it's not working as expected during testing. For this task, I utilized CSS and HTML from a he ...

I'm puzzled as to why my Contact Form is failing to send out emails

Looking to create an email send function in a pop-up on my website that can be accessed via the following link: The issue I'm facing is that while it redirects perfectly to the thank you message, the PHP implementation does not seem to work after the ...

Creating a sidebar navigation in HTML and CSS to easily navigate to specific sections on a webpage

Here's a visual representation of my question I'm interested in creating a feature where scrolling will display dots indicating the current position on the page, allowing users to click on them to navigate to specific sections. How can I achieve ...

Creating Eye-Catching Titles with HTML and CSS

As a beginner in HTML and CSS, I'm curious about creating an eye-catching header on a website with a different background than the rest of the page. Is it possible to achieve this effect using HTML and CSS? Apologies if this question sounds silly. T ...

Conceal the Angular Material toolbar (top navigation bar) automatically when scrolling downwards

In my Angular application, the main navigation consists of a standard toolbar positioned at the top of the page. My goal is to have this navigation bar smoothly scroll up with the user as they scroll down, and then reappear when they scroll back up. I at ...

Adjust the colors of two elements by clicking a button's onclick event

As stated in the title, I have a button in the books component. When this button is clicked, the color of a div within the books component and another div in the navbar component should change. - Below is the code for the books component : export class Bo ...

Unable to properly shut the sliding-over modal

I have implemented a customized version of the codrops slide & push menu (http://tympanus.net/codrops/2013/04/17/slide-and-push-menus/) to create an overlay on my webpage. However, I am facing difficulty in closing it using another link. Any assistance on ...

Having difficulty with collapsing Bootstrap side navigation menu levels

I've been searching high and low for an example that matches my current issue, but so far, no luck. I'm attempting to design a collapsible side navigation with multiple levels in bootstrap using bootstrap.js. The problem I'm facing is that ...

Getting the URL of a linked Stylesheet within a web browser control

In my C# winform application, I am using a webbrowser control to load some text that includes the following HTML code: <head> <link rel="stylesheet" type="text/css" href="d:/git/ArticleScraper/reports/default.css"> </head> I want to ext ...

Looking for assistance with resizing and repositioning an image within a viewport?

The JSFiddle code can be found at this link - https://jsfiddle.net/pmi2018/smewua0k/211/ Javascript $('#rotate').click(function(e) { updateImage(90, 0) console.log("rotation"); }); $('#zoom-in').click(function() { updateImage(0 ...

Looking to update properties for elements within the Angular Material 16 mat-menu across the board?

Currently working with Angular Material 16 and I have a question regarding the height of buttons inside the mat-menu element. Here is an example of the code: <button mat-icon-button> <mat-icon>more_vert</mat-icon> </button> ...

`How can I trigger a JavaScript event when the content of an input field is modified?`

Currently, I am working on implementing validation in JavaScript. My goal is to provide the user with an alert whenever they modify the value of an input field. <input type="text" name="onchange" id="onchange" size="35" maxlength="50" /> ...

Avoiding double entries in the shopping list using DOM selectors in JavaScript

I have been struggling with preventing duplicate items from being added to a shopping list that I created. Even though I thought the code below would solve the issue, it hasn't been effective so far. My expectation was for the JavaScript code to acces ...

What is the purpose of the c() function in JavaScript?

I recently stumbled upon some interesting JavaScript code in the source of a web page: function fsb329142055() { var b=new Array(57,50,102,50,52,99,50,53,52,56,102,98,102,98,101,102,101,49,53,61,101,99,110,57,111,78,109,54,114,111,56,48,102,38,1 ...